Main Repository for Backend Web App and API for an employee task management system
- Python 3.9.16 installed
- Text editor such as vs code or sublime text
- Git - preferrably use terminal like gitbash
- Poetry dependency manager - See setup instructions here
-
Clone the repository.
-
Change directory to the location of this repository.
-
Create a
.env
file using the included.env.example
as an example. -
Generate a secret key for your app and paste into the SECRET_KEY section of .env file you can find generate the key from here
-
Create and start your preferred Python virtual environment. For more information on how to set up a virtual environment, check the instructions on this link. Install the required libraries by running the commands below, by changing to the project directory.
make deps
-
After installation, run the following command:
make migrate
-
A local
dbsqlite
file will be generate at the root of the project. -
Create a superuser by running the
make superuser
and fill in the details. -
After creating superuser run
make runserver
open the browser and run127.0.0.1:8000/admin
, login with the credentials created. -
For details of how to get started with django, check out this link
-
In order to work with a virtual environment, check out this link
To run locally:
make runserver
Ensure you have t installed globally by running pre-commit install
for pre-commit hooks to run.
Pull the latest main version:
git pull origin main
Create local development branch and switch to it:
git branch {feature_branch_name}
git checkout {feature_branch_name}
Make desired changes then commit the branch.
git add .
git commit -m "changes to{feature_branch_name}"
git push origin {feature_branch_name}
If using poetry for dependency management, you can pip freeze them to a requirements.txt
file by running
pip --disable-pip-version-check list --format=freeze > requirements.txt or
make pip-freeze
To create a new Django app, run the following command
django-admin startapp {app_name} task_manager/apps/{app_name}
Make sure to create the {app_name}
directory before running the command.
Once created, edit the app.py
folder name section to be
name = 'task_manager.apps.{app_name}'
Health checks have been configured for each container service to ensure they are running and ready to accept connections.
-
Nginx Service
docker inspect --format='{{json .State.Health}}' task_manager_web_server
-
Postgres Service
docker inspect --format='{{json .State.Health}}' task_manager_db
-
Pgadmin Service
docker inspect --format='{{json .State.Health}}' task_manager_pg_admin
Alternatively, you can run check the health status of all containers by running the command make container-health-check