[英]Server error 500 on Django when deployed on Heroku when debug is set to False
Website is fine when debug is true, but when set to false it gives me a server error 500 evertime on every page.当 debug 为 true 时网站很好,但是当设置为 false 时,它在每个页面上都会给我一个服务器错误 500。 When i go into heroku logs --tail it tells me there is a status 500 issue.
当我进入 heroku logs --tail 时,它告诉我存在状态 500 问题。 I have set up my allowed host so that is not an issue.
我已经设置了我允许的主机,所以这不是问题。
Does anyone have any suggestions on what the root of the issue could be?有没有人对问题的根源有什么建议?
Would appreciate any advice, thanks.将不胜感激任何建议,谢谢。
Try adding DEBUG_PROPAGATE_EXCEPTIONS = True
in your setting.py.尝试在 setting.py 中添加
DEBUG_PROPAGATE_EXCEPTIONS = True
。 with this, you can see the errors in the log.有了这个,您可以在日志中看到错误。
Secondly, the major cause to this error is usually the static files serving via whitenoise.其次,此错误的主要原因通常是通过白噪声提供的静态文件。 Run
heroku run python manage.py collectstatic
, but before that make sure your STATIC_ROOT is correct.运行
heroku run python manage.py collectstatic
,但在此之前请确保您的 STATIC_ROOT 是正确的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.