This repository contains a minimal example of running a Django todo application inside Docker containers. The stack includes PostgreSQL, Redis and Celery along with an Nginx reverse proxy. It is intended for local development or experimentation.
-
Clone the repository and change into the project directory.
-
Create a
.envfile by copying the provided sample:cp .env_sample .env
Adjust any values if necessary (database credentials, email settings, etc.).
-
Build and start the containers using Docker Compose:
docker-compose up --build
This command launches the following services:
web: the Django application running with the built image.db: a PostgreSQL instance used by Django.redis: a Redis instance for Celery tasks.celery_workerandcelery_beat: background task processing.nginx: serves static files and proxies requests to Django.
-
Access the application. Once the containers are running, visit http://localhost:8080/ in your browser.
-
Run migrations inside the
webcontainer:docker-compose exec web python manage.py migrate -
Create a superuser to access the Django admin:
docker-compose exec web python manage.py createsuperuser -
Stop the containers when done:
docker-compose down
├── Dockerfile # Build instructions for the Django app image
├── docker-compose.yml # Multi-container setup
├── config # Configuration files (Nginx)
├── src # Django project source code
└── .env_sample # Example environment variables
The src directory contains the Django project (todoproject) and the todo app with simple models, views and Celery tasks.
Automated tests live inside the src directory. Execute them using Django's test runner:
python src/manage.py testGitHub Actions run the same command on every push or pull request to the main branch.
This README aims to provide enough information to get the containers running quickly. Feel free to modify the setup to suit your own development workflow.