DEBUG, SECRET_KEY, and ALLOWED_HOSTS
Get the dangerous settings right.
Three Dangerous Settings
Three settings in settings.py can sink a production site if you get them wrong. Let us tame DEBUG, SECRET_KEY, and ALLOWED_HOSTS together. 🔒
What DEBUG Does
When DEBUG is True, Django shows detailed error pages with your code, settings, and traceback. That is gold in dev but a gift to attackers in production.
DEBUG = TrueAll lessons in this course
- DEBUG, SECRET_KEY, and ALLOWED_HOSTS
- HTTPS, HSTS, and Secure Cookies
- XSS, CSRF, and SQL Injection Defenses
- Running the Deployment Checklist