【发布时间】:2014-03-25 07:53:16
【问题描述】:
我不明白为什么 django 不使用我的 500.html 模板来处理服务器错误。 我在 Elastic Beanstalk 上部署了我的应用程序,虽然所有 404 请求都由 404.html 模板处理,但 500 错误显示标准 apache 错误:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.25 (Amazon) Server at myapp.elasticbeanstalk.com Port 80
可能是什么? (我把两个模板放在同一个地方)
【问题讨论】:
-
是否所有 500 个错误都显示了这些错误,即使是您故意创建的错误?或者这可能是一个特定的错误?
-
mmm...好问题...实际上该错误是由未处理的DoesNotExist异常引起的...因此,在我看来,这是一个简单的错误情况,必须由使用500的框架处理.html 模板
-
请检查是否设置了 [DEBUG_PROPAGATE_EXCEPTIONS] (docs.djangoproject.com/en/dev/ref/settings/…)。另外,请查看 apache 和 django 的日志
标签: django amazon-web-services amazon-elastic-beanstalk