【发布时间】:2021-12-09 14:07:33
【问题描述】:
问题如标题。如何为 django 中的错误设置自定义页面。我尝试在模板中使用 '403.html' 这样的新文件,但它不起作用。
我也试过这个:
def handler404(request, exception, template_name="404.html"):
response = render_to_response(template_name)
response.status_code = 404
return response
但我无法导入 render_to_response
【问题讨论】: