当“wonky”出现时,如何覆盖 mod_python 的默认 500 错误Django 配置问题罢工?

发布于 2024-09-27 16:04:37 字数 495 浏览 1 评论 0原文

当 Django 启动时,它会处理 500 个错误。当姜戈被搞砸时, mod_python 将抛出一个简单的“内部服务器错误”。这是 在以下链接的文档中有很好的描述:

http:// docs.djangoproject.com/en/dev/howto/deployment/modpython/#error-handling

我的问题:有没有办法覆盖“内部服务器错误” 页面而不覆盖所有 Django 500 页面?我能找到的唯一方法 可以通过使用 Apache 的 ErrorDocument 来覆盖它 设置,然后将覆盖所有 500,无论是否由 Django 处理 或阿帕奇。

有没有办法协商让 Django 处理 Django 错误,但是 仍然自定义默认消息?我很想知道。

提前致谢!

When Django is up, it handles 500 errors. When Django is screwed,
mod_python will throw a bare bones "Internal Server Error." This is
described well in the docs at the following link:

http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#error-handling

My question: Is there a way to override that "Internal Server Error"
page without overriding all Django 500 pages? The only way I can find
to override it is by screwing around with Apache's ErrorDocument
setting, which will then override all 500s, whether handled by Django
or Apache.

Is there a way to negotiate that so Django handles Django errors, but
still customize the default message? I would love to know.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

那伤。 2024-10-04 16:04:37

对于该 VirtualHost 或该配置,您可以指定 Apache HTTP 500 错误。实现自定义错误消息很容易

只需将这一行添加到您的 apache 配置中

ErrorDocument 500 http://www.example.com/error_500.html 

即可了解更多信息:http ://httpd.apache.org/docs/2.0/custom-error.html

For that VirtualHost or that configuration, you can specify the Apache HTTP 500 Error. Implementing custom error messages is easy

Just add the line to your apache configuration

ErrorDocument 500 http://www.example.com/error_500.html 

For more information: http://httpd.apache.org/docs/2.0/custom-error.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文