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!

  2. Thanks for sharing. Django is the powerful framework of Python. Kanhasoft is the leading Django web development company in India and USA. With the team of 45 experienced Web developers, we are outsourcing mobile and web application services to Canada, USA, Denmark, Australia, South Africa and more.

  3. Great work man.Thank you

  4. Very Helpful and informative blog! Keep sharing such blogsSoftware Development Company in India

  5. Nice! thank you so much! Thank you for sharing. Your blog posts are more interesting and informative. I think there are many people like and visit it regularly, including me. Custom Software Development Services

  6. Great ideas and relevant information about the software developer which are work for their convenience, thank you for the blog here alofatechlabs