Recently I started a new simple project in Django. I wrote some middleware. but in one of the middlewares, I want to know which URL is called because I have to make a decision which is related to URL.
I used this code:
import os
path = os.environ['PATH_INFO']
but it makes an error which is described below:
raise KeyError(key) from None
KeyError: 'PATH_INFO'
so how I can know the URL in my middleware?