【发布时间】:2013-10-09 05:52:00
【问题描述】:
我正在尝试学习 django,并且我有一个小型测试服务器(不是开发),我正在尝试托管一个小型博客站点(类似于官方教程)。
我想要自定义 404 和 500 视图,所以,我在 urls.py 中有以下内容:
from mystuff.views import Template404View, Template500View
handler404 = Template404View.as_view()
handler500 = Template500View.as_view()
在我的views.py 中,我有以下内容:
class Template404View(TemplateView):
template_name = "404.html"
class Template500View(TemplateView):
template_name = "500.html"
404.html 和 500.html 存在于我的 site_templates 目录中。
但是,当我在我的测试服务器上托管它时,我看到的不是 400 或 500 个自定义页面,而是Internal Server Error。
我试图在 SO 上查找类似的问题,我看到了 following,但这似乎没有帮助...
任何建议将不胜感激...谢谢。
【问题讨论】:
标签: django django-templates django-views