简体   繁体   English

当 debug 设置为 False 时,在 Heroku 上部署 Django 时出现服务器错误 500

[英]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.

相关问题 使用 Heroku 和 Django 时 Debug=False 时出现 500 错误 - 500 error when Debug=False with Heroku and Django 当 DEBUG=False 时 django 服务器错误 (500) - django server error (500) when DEBUG=False 每当django中debug = False时,Heroku会显示Server Error(500),而debug = True no error时 - Whenever debug=False in django, Heroku gives Server Error (500) and when debug=True no error Dango应用未正确部署在Heroku上:DEBUG = False时服务器错误500,DEBUG = True时未正确加载索引视图 - Dango app not deployed correctly on Heroku: Server Error 500 when DEBUG=False, not loading index view correctly when DEBUG=True 为什么只有当 Debug=False AND db 设置为 Heroku 上的生产数据库时,django 才会在服务器 500 上失败? - Why would django fail with server 500 only when Debug=False AND db is set to production database on Heroku? 尝试在 heroku 上使用 DEBUG=False 部署 django 应用程序时出现服务器错误 (500) - Server error (500) when trying to deploy django app with DEBUG=False on heroku 当Debug = False时,在Heroku中出现500错误 - 500 error in Heroku, when Debug=False 调试设置为 False 的已部署 django 应用程序上出现 500 错误 - 500 error on deployed django app with debug set to False 当生产中的debug = False时500服务器错误 - 500 server error when debug=False in production 当 DEBUG=False 时服务器错误 500 - Server Error 500 when DEBUG=False
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM