django 关闭debug模式,报500错误

今天关闭了程序的debug模式,结果提示500错误。但是启动debug模式,又运行正常。

Server Error (500)

上网查了以后,发现django1.5版本的要设置ALLOWED_HOSTS 字段。

往settings.py里添加ALLOWED_HOSTS字段:

ALLOWED_HOSTS = ['*']

记得重启httpd:

/etc/init.d/httpd restart

再访问,一切正常。

原文地址:https://www.cnblogs.com/xiami303/p/3341313.html