开发者

Django order of execution

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜