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 settings.py, 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 settings.py 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 settings.py, changed ALLOWED_HOSTS value in the following way:
ALLOWED_HOSTS = ['123.123.198.123']
# 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:
ALLOWED_HOSTS = ['www.example.com']
You can also use a '*' wildcard to allow all hosts. But this is not recommended in the production environment.
ALLOWED_HOSTS = ['*']
You can find a full detail regarding the ALLOWED_HOSTS settings here hidden deep inside django document  

22 comments:

  1. Your my hero. On my blog technelogos.com/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!

    ReplyDelete
  2. Great work man.Thank you
    (https://counfreedise.in/)

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

    ReplyDelete
  4. 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

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

    ReplyDelete
  6. This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work. I have been meaning to write something like this on my website and you have given me an idea.

    data science course in India

    ReplyDelete
  7. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!
    Artificial Intelligence Course

    ReplyDelete
  8. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.
    Mulesoft training in hyderabad

    ReplyDelete
  9. Well explained, this post has the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    ServiceNow Training in Chennai

    ReplyDelete
  10. This post is very simple to read and appreciate without leaving any details out. Great work !
    ServiceNow Training in Chennai

    ReplyDelete
  11. Retaining a fresh home is usually difficult, especially on the subject of the kitchen's. Refrigerators are likely to need far more care than most of them receive in addition to that’s the reason DIALAMAID is desirous to provide family fridge cleaning for addition to our housecleaning products and services. From leaking beverages to help remnants connected with food, products stored with your fridge can seem unattainable to retail store without anything getting found lacking. When people add that service on your cleaning approach, you can feel comfortable we’ll leave the medial side and away from your freezer looking including new. cleaning companies in dubai

    ReplyDelete
  12. <a href="https://biggbossmalayalamvote.in/'> Bigg Boss Malayalam</a>


    Keeping the refrigerator fresh and sanitized amid everyday spills and messes can be a challenge. That's why our home cleaning services now include thorough fridge cleaning. From wiped out shelves to sticky drawer pulls, we tackle the tough grime that builds up inside your fridge.

    Our experts use eco-friendly solutions and powerful disinfectants to dissolve residues and eliminate odors. We scrub away sticky spills, clean out crisper drawers, and sanitize every surface to restore order. With deep cleaning services for both the interior and exterior, we'll have your fridge looking and smelling brand new again.

    Trust us to handle the toughest dirt and grime so your fridge is always ready for safe food prep and storage. Our meticulous cleaning transforms your fridge, leaving every shelf, bin, and drawer refreshed. Contact us today to add expert fridge cleaning to your home services.

    ReplyDelete
  13. Wonderful blog you have here, but I was wondering if you knew of any forums that cover the same topics discussed in this article? I’d really like to be part of a community where I can get suggestions from other knowledgeable individuals who share the same interests. If you have any recommendations, please let gautham digital learning

    ReplyDelete