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  

44 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. 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.

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

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

    ReplyDelete
  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

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

    ReplyDelete


  7. I am reading your post from the beginning, it was so interesting to read & I feel thanks to you for posting such a good blog, keep updates regularly.I want to share about tibco training .

    ReplyDelete
  8. Revolution of Data Science has changed the world with its substantial impact. It is a study of data or information, what it represents, from where it is obtained and how to transform it into a valuable method when formulating business and IT policy. data science course syllabus

    ReplyDelete
  9. 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
  10. I just loved your article on the beginners guide to starting a blog.If somebody take this blog article seriously
    in their life, he/she can earn his living by doing blogging.Thank you for this article.
    tibco sportfire online training

    ReplyDelete
  11. 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
  12. This is a wonderful article, Given so much info in it, Thanks for sharing. CodeGnan offers courses in new technologies and makes sure students understand the flow of work from each and every perspective in a Real-Time environment AR Training in Vijayawada. ,

    ReplyDelete

  13. That is nice article from you, this is informative stuff. Hope more articles from you . I also want to share some information about bw Training

    ReplyDelete
  14. This is very informative blog.i have learn lots from your blog, keep updating.
    Mulesoft Training In Hyderabad

    ReplyDelete
  15. 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
  16. Very nice blog, with a lot of new information. Thanks for sharing the wonderful blog. Keep going on.
    Ubs accounting
    Myob Singapore
    Skill future accounting software
    Best Accounting software Singapore

    ReplyDelete
  17. 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
  18. It is truly a well-researched content and excellent wording. I got so engaged in this material that I couldn't wait reading. I am impressed with your work and skill. Thanks.
    Mulesoft training in hyderabad

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

    ReplyDelete
  20. As I am looking at your writing, 파워볼사이트 I regret being unable to do outdoor activities due to Corona 19, and I miss my old daily life. If you also miss the daily life of those days, would you please visit my site once? My site is a site where I post about photos and daily life when I was free.

    ReplyDelete
  21. I am inspired with your post writing style & how continuously you describe this topic. micro nutrient for plant

    ReplyDelete
  22. you will need support or suggestions, write me privately.
    I interested in your implementation/use case.
    the best situs slot terbaik
    Togel2win

    ReplyDelete
  23. İnstagram takipçi satın al! İnstagram takipçi sitesi ile takipçi satın al sende sosyal medyada fenomen olmaya bir adım at. Sende hemen instagram takipçi satın almak istiyorsan tıkla:

    1- takipçi satın al

    2- takipçi satın al

    3- takipçi satın al

    ReplyDelete
  24. Mule masters Hyderabad,provides 100% job assistance, extending real time projects for practical knowledge this is best course you have interest visit my website link https://mulemasters.in/

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