Friday, 30 January 2015

Django Setting DEBUG = False causes 500 Error - Django 500 error debug false - ALLOWED_HOSTS Problem [SOLVED]

Python Django alirazabhayani Full stack development
Django Debug False 500 error Solved
Being involved in Full Stack Django/Python Web Application Development for 3 years now, I recently deployed my Django application on a test server and encountered Server Error (500) on Django when template debug is set to False. That is in Django, when I changed DEBUG = FALSE from DEBUG = TRUE, it caused 500 error.

I had upgraded my application from Django 1.4 to Django 1.7. I came to know that 500 error on DEBUG = False error is encountered by everyone using django 1.5 or greater as soon as they change their to DEBUG = False. Well my problem got solved after reading several blogs and digging deeper in the Django Docs for DEBUG = False ALLOWED_HOSTS settings

What I did was, in, changed ALLOWED_HOSTS value in the following way:
# Above mentioned IP is not my actual IP. Enter your actual server IP or domain name here. 

If you have a domain name of your server, you may write:
You can also use a '*' wildcard to allow all hosts. But this is not recommended in the production environment.
You can find a full detail regarding the ALLOWED_HOSTS settings here hidden deep inside django document  


  1. Your my hero. On my blog, I've been trying to solve this error at least for the past few months. Nothing worked until I came across this blog post. I can't thank you enough!