0

I'm using the view decorator @require_http_methods(["POST"]). If anything but a post request is sent, it should redirect the user to a custom 405 error page.

The 405.html template is located inside the folder root/templates/405.html. Django's default 405 page is displayed (a pure html error page), however, when an error occurs. All other error templates (404.html, 500.html) inside this templates folder work correctly. Why is this?

pyknight202
  • 502
  • 1
  • 3
  • 13

1 Answers1

1

Please, refer to this question:

How to display a custom error page for HTTP status 405 (method not allowed) in Django when using @require_POST

There is no default handler for the 405 error. You would need to implement a custom middleware to catch the 405 error and redirect to a custom template view.

Jônatas Castro
  • 374
  • 2
  • 11