Django in production: set DEBUG = False raises `Server error (500)`

I know this 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 install DEBUG = False

on a production server, the Django app works fine for maybe half a day. And after that the annoying one Server Error (500)

always appears for certain functions, but not for all. If I come back DEBUG = True

, everything will be fine.

I also installed ALLOWED_HOSTS = ['*']

. Some said it shouldn't be a wild card in production. But my app is public, how do I install it? Others said it should be 'localhost'

. But just localhost

can access the server? Why do you need production, then?

Is there a standard solution to this problem? Thank.

+3


source to share


1 answer


A 500 production error is not something you should be guessing about.

You need to know exactly what, where and when it happens:

ADMINS

Default: () (empty tuple)

A tuple that lists the people receiving code error notifications. when DEBUG = False and the view raises an exception, Django will email these messages to people with complete exception details.



Other related materials:

I understand that it does not give you an answer and does not directly solve your problem, but I hope you get my assessment, thanks.

+5


source







All Articles