Reputation: 4353
I know this question has been discussed. But the problem persists, and I am left without any solution. Please help.
My platform is: Ubuntu 14.04 LTS, Python 3.4, MySQL 5.5, Django 1.7, Nginx 1.4.6, and Gunicorn 19.1.1.
When I set DEBUG = False
in the production server, my Django application runs OK for maybe half a day. And after that, the annoying Server Error (500)
always appear for certain functions, but not every one. If I turn DEBUG = True
, everything will be fine.
I also set ALLOWED_HOSTS = ['*']
. Some said that it should not be a wild card in production. But my app is for public, how should I set it? Others said that it should be 'localhost'
. But only localhost
can access the server? Why go production, then?
Is there a standard solution to this problem? Thanks.
Upvotes: 4
Views: 3640
Reputation: 473873
500 error on production is not something you should make guesses about.
You need to know exactly what, where and when is it happening:
ADMINS
configuration setting and receive emails on critical errorsADMINS
Default: () (Empty tuple)
A tuple that lists people who get code error notifications. When DEBUG=False and a view raises an exception, Django will email these people with the full exception information.
Other related materials:
I understand that it doesn't provide you with an answer and doesn't directly solve your problem, but I hope you get my point, thanks.
Upvotes: 5