【发布时间】:2020-10-02 19:15:46
【问题描述】:
我正在使用视图装饰器@require_http_methods(["POST"])。如果发送了除了 post 请求之外的任何内容,它应该将用户重定向到自定义 405 错误页面。
405.html 模板位于文件夹root/templates/405.html 内。 Django 的默认 405 页面会显示(纯 html 错误页面),但是,当发生错误时。此模板文件夹中的所有其他错误模板(404.html、500.html)都可以正常工作。这是为什么呢?
【问题讨论】:
-
因为
page_not_found视图是这样工作的? docs.djangoproject.com/en/3.0/ref/urls/…
标签: django