Docker Compose configuration for Django development (and production) with Nginx, Celery, Redis and PostgreSQL
A boilerplate to deploy Django with cool stuff. Also serves as an example project from these tutorials:
- Deploy Django, Gunicorn, NGINX, Postgresql using Docker
- Serve Static Files by Nginx from Django using Docker
- Docker: Use Celery in Django (Redis as Broker)
The above tutorials describe how this boilerplate was created from scratch so that you can build your own.
- Fork the repo to your GitHub account.
git clonethe repo to your local computer.- Run
make buildinside the root directory to build/rebuild (if necessary) all the containers in the project. - Then run
make upto start the containers and have them run as a daemon process (i.e., in the background). - Visit
http://localhost:8000/to see the project. - Visit
http://localhost:8000/adminto view the admin login screen. No users have been setup, so you won't be able to login until after you have done that.
Checkout the commands section below for more usage.
A default Django project resides in src directory. When you start the project, you will see the following screen at http://localhost:8000/:
Also when you access the django container log via make log-web, you will see the following:
The following commands can be run inside the project root directory (see the Makefile in this project for more details):
make buildto build/rebuild (if necessary) all the containers in the project.make upto start the containers and have them run as a daemon process (i.e., in the background).make up-non-daemonto start containers and have them run as a non-daemon process.make startto start containers, if the project has already been built.make stopto stop containers.make restartto restart containers.make shell-webto gain shell access into the web container.make shell-dbto gain shell access into the db container.make shell-nginxto gain shell access into the nginx container.make log-webto view the logs in the web container.make log-dbto view the logs in the db container.make log-nginxto view the logs in the nginx container.make collectstaticto put static files in the static directory.

