December 2016
Beginner to intermediate
694 pages
14h 2m
English
During the request phase, before calling the view, Django applies middleware in the order it's defined in MIDDLEWARE_CLASSES, top-down. Two hooks are available:
process_request()process_view()During the response phase, after calling the view, middleware are applied in reverse order, from the bottom up. Three hooks are available:
process_exception()process_template_response()process_response()If you prefer, you can also think of it like an onion: each middleware class is a layer that wraps the view.
The behavior of each hook is described below.
Read now
Unlock full access