class ExceptionMiddleware
New in Django 1.10.
Catches exceptions raised during the request/response cycle and returns the appropriate response.
-
Http404
is processed byhandler404
(or a more friendly debug page ifDEBUG=True
). -
PermissionDenied
is processed byhandler403
. -
MultiPartParserError
is processed byhandler400
. -
SuspiciousOperation
is processed byhandler400
(or a more friendly debug page ifDEBUG=True
). - Any other exception is processed by
handler500
(or a more friendly debug page ifDEBUG=True
).
Django uses this middleware regardless of whether or not you include it in MIDDLEWARE
, however, you may want to subclass if your own middleware needs to transform any of these exceptions into the appropriate responses. LocaleMiddleware
does this, for example.
Please login to continue.