User interface using Django to add staff and clients and associate projects.
- Python 3.11
- Django 4.1
- Pyscopg2
- PostgreSql 15
- Docker
In order for the Django server to communicate with PostgreSql, it is necessary to write the necessary information against the fields in the app/.env
file. If the file doesn't exist, create it.
DEBUG=<True or False>
SECRET_KEY=verysecret
ALLOWED_HOSTS=*
POSTGRES_NAME=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
SQL_HOST=db
SQL_PORT=5432
We can create images for development and production.
This command creates and runs development images with docker-compose.dev.yml
files data.
docker-compose -f docker-compose.dev.yml up
When your app/.env
file is ready, then run this command for creating and running image. Thanks to -d
flag, we can run the application in background.
docker-compose -f docker-compose.prod.yml up -d
Now your project is running at 127.0.0.1:8000.
After stopping the application, we reach inside the container and tell Django to create a superuser.
docker-compose -f docker-compose.prod.yml run web python manage.py createsuperuser
-f
stands for file and specifies whichdocker-compose
to use. Usedocker-compose.dev.yml
for development and of cousedocker-compose.prod.yml
for production.web
is the Docker container name for Django application.- After entering this command, you need to create a super user with username and password.
Now you can start docker image again!