Deploy a Django app to production
When you ask an agent for 'a web app with admin and auth', you get Django. It's the most batteries-included stack on this list — and the one with the most deploy-time ritual: migrations, collectstatic, a WSGI server. Launchmatic has a place for each.
How detection works
A requirements.txt with django (plus manage.py at the root). Nixpacks installs Python and dependencies; you supply the gunicorn start command.
Build configuration & gotchas
Start command
gunicorn myproject.wsgi --bind 0.0.0.0:$PORT — add gunicorn to requirements.txt; agents usually forget it because runserver worked locally.
Migrations
Set the pre-deploy command to python manage.py migrate — it runs in the release phase before the new version takes traffic, so schema and code stay in step.
Static files
Use WhiteNoise: add it to MIDDLEWARE, set STATIC_ROOT, and run python manage.py collectstatic --noinput as part of the build. No separate CDN required to start.
Settings
ALLOWED_HOSTS = ["*"] behind Launchmatic's proxy (or your exact domain), DEBUG = False, and read SECRET_KEY/DATABASE_URL from the environment — dj-database-url parses the injected URL in one line.
Environment variables
DATABASE_URLParse with dj-database-url; injected when you link Postgres.SECRET_KEYSet with `lm env set SECRET_KEY=...` — never commit it.ALLOWED_HOSTSYour domain(s), comma-separated, read in settings.py.Django service setup, start to finish:
lm init
lm db create app-db --service <serviceId> # id printed by lm init
lm deploy \
--start-cmd "gunicorn myproject.wsgi --bind 0.0.0.0:\$PORT" \
--pre-deploy-cmd "python manage.py migrate"
# overrides persist — future deploys are just: lm deployFAQ
Where do Django migrations run?+
In the release phase: set `python manage.py migrate` as the pre-deploy command and it executes against your linked Postgres after the build succeeds but before the new pods receive traffic.
Ready to deploy?
Free to start. No credit card. Auto-SSL on custom domains, managed Postgres, and per-branch preview deploys included.
This guide is part of our complete vibe coding hosting guide — how to take any AI-built app to production.