web service on the Python runtime, with a managed Postgres
alongside it.
Prerequisites
A Django project in a GitHub or GitLab repository, withgunicorn in your requirements.
Configure the app
Django rejects requests whoseHost header is not in ALLOWED_HOSTS, which otherwise shows
up as a 403 on a deploy that looks healthy.
settings.py
Add slipway.yaml
slipway.yaml
myproject with your project package.
preDeploy runs migrations in the freshly built image before the rollout, and the deploy
proceeds only if it exits 0.
Set the secret
Before the first deploy, addDJANGO_SECRET_KEY under the project’s
Settings → Variables & secrets. A reference nothing satisfies leaves the key unset and
records a warning in the deploy log, so set the value first to start with it in place.
Add a health check endpoint
urls.py
Static files
For WhiteNoise, collect during the build:slipway.yaml
Add a worker
slipway.yaml
slipway.yaml
Next steps
Postgres
Credentials, backups and external access.
Troubleshooting
What to check when a deploy goes wrong.