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:
If you have a domain name of your server, you may write:
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
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!
ReplyDeleteGood job man!
ReplyDeletethanks!!!
ReplyDeleteSaved
Thank you...
ReplyDeleteThanks 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.
ReplyDeleteGreat work man.Thank you
ReplyDelete(https://counfreedise.in/)
Very Helpful and informative blog! Keep sharing such blogsSoftware Development Company in India
ReplyDeleteGreat Article
ReplyDeleteFinal Year Projects for CSE in Python
FInal Year Project Centers in Chennai
Python Training in Chennai
Python Training in Chennai
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
ReplyDeleteGreat ideas and relevant information about the software developer which are work for their convenience, thank you for the blog here alofatechlabs
ReplyDeletenice information thanks for sharing........................!
ReplyDeleteActive Directory online training
Active Directory training
Appian BPM online training
Appian BPM training
arcsight online training
arcsight training
Build and Release online training
Build and Release training
Dell Bhoomi online training
Dell Bhoomi training
Dot Net online training
Dot Net training
ETL Testing online training
ETL Testing training
Hadoop online training
Hadoop training
Tibco online training
Tibco training
Tibco spotfire online training
Tibco spotfire training
ReplyDeleteI 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 .
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
ReplyDeleteThis 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.
ReplyDeletedata science course in India
I just loved your article on the beginners guide to starting a blog.If somebody take this blog article seriously
ReplyDeletein their life, he/she can earn his living by doing blogging.Thank you for this article.
tibco sportfire online training
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!
ReplyDeleteArtificial Intelligence Course
Aivivu chuyên vé máy bay, tham khảo
ReplyDeletegiá vé máy bay tết
vé máy bay đi Mỹ tháng nào rẻ nhất
vé máy bay đi Pháp giá rẻ
vé máy bay đà nẵng đi hàn quốc
vé máy bay qua nhật
bay từ việt nam sang Anh mất bao lâu
săn vé máy bay 0 đồng
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Đặt vé máy bay tại Aivivu, tham khảo
ReplyDeletevé máy bay đi Mỹ giá bao nhiêu
các chuyến bay từ mỹ về việt nam hiện nay
giá vé máy bay từ đức về việt nam
vé máy bay từ nga về tphcm