Docker lets you run a project in the same environment on any machine. In this article we bring up Django, PostgreSQL and Nginx with a single command.

1. Key files

  • Dockerfile — Python environment and dependencies
  • docker-compose.yml — web, db and nginx services
  • .env — secret settings

2. Start it

docker compose up -d --build
docker compose exec web python manage.py migrate

After that the site opens at http://localhost. In production, don’t forget to set DEBUG=False and collect static files.