Didina Deen Didina Deen - 8 months ago 39
Python Question

'dict' object has no attribute 'HTTP_REFERER'

I've been trying to find the previous url following this answer:

Django request to find previous referrer

So, in my .py I did:

print request.META
print request.META.HTTP_REFERER
print request.META['HTTP_REFERER']

request.META returns:

{'RUN_MAIN': 'true', 'HTTP_REFERER': '', 'XDG_GREETER_DATA_DIR': '/var/lib/lightdm-data/user', 'QT4_IM_MODULE': 'xim',....

So, I can see HTTP_REFERER is there, but when trying to access it either way I get the error:

<type 'exceptions.AttributeError'>
'dict' object has no attribute 'HTTP_REFERER'

How can I access it?


I would suggest: