Non-global middleware in Django

前端 未结 8 1015
生来不讨喜
生来不讨喜 2020-12-12 21:59

In Django there is a settings file that defines the middleware to be run on each request. This middleware setting is global. Is there a way to specify a set of middleware

8条回答
  •  醉话见心
    2020-12-12 22:54

    You can use process_view method, that is called before calling the view func. In process_view you can check — if this view requires this middleware interception.

提交回复
热议问题