HOME / INSIGHTS / ENGINEERING ENGINEERING · 22 August 2026

Hardening a Django Deployment for Production Traffic

Notes from the field: caching, session isolation and the small misconfigurations that cost the most.

Hardening a Django Deployment for Production Traffic

Django ships secure defaults, which is exactly why so many production issues we see come from someone turning a setting off during development and forgetting to turn it back on before launch. DEBUG=True left on in production is still, somehow, the most common single misconfiguration we find during audits — and it hands an attacker a full stack trace, settings dump, and SQL query log for free.

Beyond the obvious, the two issues with the highest real-world impact are session isolation and cache key collisions. Running your session store on the same Redis database index as your page cache means a cache flush can silently log out every active user — annoying at best, and a sign that other data boundaries in your infrastructure might be equally loose.

SECURE_SSL_REDIRECT, SESSION_COOKIE_SECURE and CSRF_COOKIE_SECURE should all be on by default the moment you're behind HTTPS, no exceptions. Pair that with a properly scoped ALLOWED_HOSTS list — not a wildcard — and you've closed off the majority of the low-effort attack paths we see attempted against Django apps in the wild.

None of this is exotic. It's mostly a checklist. The teams that get hurt aren't the ones who skipped something complicated — they're the ones who never ran the checklist at all before their first production deploy.

Back to Insights