A template project with:
- Python 3.12
- Django 4.2 LTS
- Postgres 16
- Development inside Docker
- Django settings such as
SECRET_KEYandALLOWED_HOSTSare configured with environment variables out of the box - Can be easily deployed to Heroku or Dokku
- Static files are served with Whitenoise
- Errors can be sent to Sentry or GlitchTip
Click on the "Use this template" button on GitHub and create a new repository.
Clone your new repository.
Ensure that you have GNU or BSD Make installed.
Run the rename Makefile target to replace all instances of django_template and django-template with your project's name in snake_case and kebab-case, respectively.
make rename PROJECT_NAME=my_project_name_with_underscoresEnsure that you have the following installed:
- GNU or BSD Make
- Docker
- Docker Compose
Build your development environment.
make buildRun your development environment.
make startOpen an interactive shell into the Docker container that contains the Django project.
make shSeveral bash aliases exist in the Django Docker container such as:
dj:python3 manage.pydjrun:python3 manage.py runserver 0:8000djtest:python3 manage.py test --settings=django_template.settings.test -v=2djtestkeepdb:python3 manage.py test --settings=django_template.settings.test -v=2 --keepdb
Run all outstanding migrations.
# Inside the Django Docker container
dj migrateSpin up the development server.
# Inside the Django Docker container
djrunThe Django app will be available at http://localhost:8000/.
Check out the Makefile for other useful commands.