Deployment
For production, compile your front-end (or use the shipped bundle), collect the static files, run with DEBUG=False, and serve through a WSGI/ASGI server. The package supports a fully Node-free deploy as well as the Vite pipeline.
Option A — Node-free (static bundle)
The package ships a compiled asset bundle inside static/adminlte/dist/, so you can deploy with zero Node. Switch the front-end to it and collect:
# settings.py
ADMINLTE = {"assets_mode": "static"}
python manage.py collectstatic --noinput
gunicorn config.wsgi
With "static", django-vite is never imported, so you don't even need it installed.
Option B — Vite pipeline
Keep assets_mode="vite" to serve your own compiled bundle (and the optional lazy-loaded plugins). Build, then collect:
npm run build # writes assets/dist/ + manifest.json
python manage.py collectstatic --noinput
gunicorn config.wsgi
Make sure django-vite runs in production (non-dev) mode so it reads the hashed manifest instead of the HMR client:
DJANGO_VITE = {
"default": {
"dev_mode": DEBUG, # False in production
"manifest_path": BASE_DIR / "assets" / "dist" / "manifest.json",
}
}
Production checklist
| Setting | Value |
|---|---|
DEBUG | False |
SECRET_KEY | Read from the environment. |
ALLOWED_HOSTS | Your production hostname(s). |
DATABASE_URL | PostgreSQL (e.g. postgres://… via psycopg[binary]). |
CSRF_TRUSTED_ORIGINS | Your HTTPS origin(s). |
| Static files | WhiteNoise (compressed, hashed manifest storage) or a CDN. |
Static files with WhiteNoise
The demo project is a twelve-factor starter that reads everything environment-specific from the environment, with production-safe defaults. With DEBUG=False it automatically enables HSTS, SSL redirect, secure cookies, and WhiteNoise's compressed manifest static storage. A typical deploy is:
# Environment: SECRET_KEY, DEBUG=False, ALLOWED_HOSTS, DATABASE_URL=postgres://…
npm run build # (Option B only)
python manage.py migrate
python manage.py collectstatic --noinput
gunicorn config.wsgi
Verify your configuration before deploying with python manage.py check --deploy. The package's own system checks (config keys, template-engine wiring, menu schema) also run here and on every runserver.
Run collectstatic on every deploy. The themed Django admin always serves the pre-built static bundle, so even in "vite" mode the admin needs static/adminlte/dist/ to be collected.