开发者

Django request_finished signal

开发者 https://www.devze.com 2023-02-07 18:31 出处:网络
How to use request_started signal in djan开发者_开发百科go? I want to execute some commands before processing a http request or do django have a callback similar with rails before_filter?

How to use request_started signal in djan开发者_开发百科go? I want to execute some commands before processing a http request or do django have a callback similar with rails before_filter?

Thanks


Consider writing your own middleware instead.


According to this doc you may use:

from django.core.signals import request_finished
from django.dispatch import receiver

@receiver(request_finished)
def my_callback(sender, **kwargs):
    # process
0

精彩评论

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