A cookiecutter template for creating a Django app deployed by Dokku (free/libre platform as a service).
Some highlights:
- Serves the Django project using gunicorn + whitenoise
- Run all services locally using docker compose, so no need to create virtualenv, mess with Python versions etc.
- Single
settings.py
so you won't have conflicts between local and production versions - Sane defaults, such as
AutoField
(instead ofBigAutoField
), suppressDissallowedHost
exception etc. - Option to enable celery (+ redis), mailhog
First, install cookiecutter and render the template using your parameters:
pip install cookiecutter
cookiecutter gh:PythonicCafe/cookiecutter-dokku-django
# answer the questions :)
cd <project_slug>
git init .
git add .
git commit -m "First commit"
Then, read the created <project_slug>/README.md
for local development instructions and
<project_slug/docs/deploy.md>
for deployment instructions.
- Fix Dokku healthchecks (do not disable) while having
*
not inALLOWED_HOSTS
(usehttpHeaders
from docker-container-healthchecker) - Add support for using Ansible with ansible-dokku
- Add a git pre-commit hook to automatically run tests, linter etc.
- Add plenty of possible email backends (SMTP, Sendgrid, Mailgun, AWS SES etc.)
- Add IMAP container for testing (something like antespi/docker-imap-devel or apache/james)
- Configure workflows (CI/CD)
- Enhance
.dockerignore
- Pin requirements' versions
- Replace
requirements.txt
/requirements-development.txt
with other dependency file type - Add option to multistage build when user needs to compile JS/CSS
- Translate
docs/deploy.md
to other languages (currently only available in Brazilian Portuguese) - Check things we're missing that other implementations have, like cookiecutter-django and django-boilerplate
If you want to change local postgres parameters so you can use less/more memory, workers etc.:
- Run
docker run --rm postgres:15-bullseye cat ./usr/share/postgresql/postgresql.conf.sample > "{{ cookiecutter.project_slug }}/docker/conf/db/postgresql.dev.conf"
- Go to pgtune.leopard.in.ua, select your parameters and add to the end of
docker/conf/db/postgresql.dev.conf
Note: replace
postgres:15-bullseye
with the image/version you want to work with.
This repository is licensed under Apache 2.0. When creating your project based on this template you can choose one of the following license options:
If you decide to use another license, just replace the LICENSE
file after rendering the project.