eriesgo / django-on-docker

Dockerizing Django with Postgres, Gunicorn, and Nginx. Tutorial found https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

This is the result of the "Dockerizing Django with Postgres, Gunicorn, and Nginx" tutorial described in https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/#static-files

Development

Build & Up

docker-compose up -d --build
docker-compose down -v

Database operations

docker-compose exec web python manage.py flush --no-input
docker-compose exec web python manage.py migrate
docker-compose exec db psql --username=hello_django --dbname=hello_django_dev
docker-compose exec db psql --username=hello_django --dbname=hello_django_prod

docker-compose logs -f

Production

Build & Up

docker-compose -f docker-compose.prod.yml up -d --build

docker-compose -f docker-compose.prod.yml down -v

Database operations

docker-compose -f docker-compose.prod.yml exec web python manage.py migrate --noinput

Logs

docker-compose -f docker-compose.prod.yml logs -f

Tests

hey -z 10s -z 3m http://localhost:1337

Version control

  • 20240107 - Tested using SSH connection

About

Dockerizing Django with Postgres, Gunicorn, and Nginx. Tutorial found https://testdriven.io/blog/dockerizing-django-with-postgres-gunicorn-and-nginx/


Languages

Language:Python 82.5%Language:Dockerfile 8.2%Language:Shell 5.3%Language:HTML 4.0%