This is a very straightforward Django project template, based on this Article by Vitor Freitas.
The purpose of this project was to create a minimal Django template that can work with docker-compose on any machine with zero configuration.
To use it, first install the cookiecutter command-line tool, and create a new project on your machine with:
cookiecutter https://github.com/henriquelalves/django-production-template
It'll properly setup the project with the name of your choosing.
To run locally, you'll have to install all Python packages:
pip install -r djangoapp/requirements.txt
And do the initial migrations:
./manage.py migrate
./manage.py runserver
The project is configured to run locally with Django's SQLite.
docker-compose up
This will create 3 containers:
NGINX
: A NGINX container running on ports 80 and 443 as a Reverse-proxy for the Django application. Its configuration files are in theconfig/nginx
folder, and it's already running with the self-signed certificates incerts
. You should change the certificates before publishing the app, or else connections will NOT be secured.DJANGO
: The Django container running the application with Gunicorn. It's environment variables should be on aconfig/djangoapp.env
file.POSTGRES
: A Postgres container that the Django Application will connect with when running on Production. It's environment variables should be on aconfig/database.env
file.