为什么我们像这样在 Django 自定义中间件中使用头等函数?

问题描述

这是一个自定义的中间件代码

def my_middleware(get_response):
    print('One time initialization')

    def my_function(request):
        print('Its before view function')
        response = get_response(request)
        print('Its after view function')
        return response
    return my_function

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)