0

error 'function' object has no attribute 'get' .inside dmy_middleware not recognized 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
JAYESH rathi
  • 41
  • 1
  • 9

1 Answers1

0

The error is because you are returning the middleware and not the function inside, this code works for me.

def my_function(get_response):_
    print('hi')
    def dmy_middleware(request):
        response = get_response(request)
        print('go')
        return response
    return dmy_middleware
Sirwill98
  • 324
  • 1
  • 13