Based on this article: https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/.
Rename the env-sample
directory to env
. Set the necessary values for environment variables.
Env files used: .env.dev
, .env.dev.db
.
Run command:
docker compose up -d --build
Env files used: .env.prod
, .env.prod.db
.
Run command:
docker compose -f docker-compose.prod.yml up -d --build
To work together with a reverse proxy server.
Env files used: .env.prod
, .env.prod.db
, .env.prod.proxy
.
Run command:
docker compose -f docker-compose.prod.for-reverse-proxy.yml up -d --build
- Apply migrations:
docker compose [-f <file_name.yml>] exec web python manage.py migrate
- Collect static:
docker compose [-f <file_name.yml>] exec web python manage.py collectstatic
- Create superuser:
docker compose [-f <file_name.yml>] exec web python manage.py createsuperuser
Alexander Aravin - sander-raven. Email: [email protected].
The project is under the MIT license. For details, see the LICENSE file.