In what order does django execute the various c开发者_如何学Pythonomponents when it receives a request? Specifically when does the middleware get invoked compared to the function that a route resolves to? And when do context processors get called?
Thanks
The middlewares are executed before the view and when returning the response. The context processor is executed when rendering a template, usually at the end of the view.
So:
(request) -> middleware, from top to bottom -> view -> context_processor -> (response) -> middleware, from bottom to top
精彩评论