[英]django midleware inside function is not recognized it is giving me error 'function' object has no attribute 'get'
error 'function' object has no attribute 'get'.inside dmy_middleware not recognized here is code错误'function' object has no attribute 'get'.inside dmy_middleware not recognize here is code
def my_function(get_response):_
print('hi')
def dmy_middleware(request):
response = get_response(request)
print('go')
return response
return my_function
The error is because you are returning the middleware and not the function inside, this code works for me.错误是因为您返回的是中间件,而不是里面的 function,这段代码对我有用。
def my_function(get_response):_
print('hi')
def dmy_middleware(request):
response = get_response(request)
print('go')
return response
return dmy_middleware
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.