Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'WSGIRequest' object has no attribute 'cookies'

Tags:

python

django

I am making a webpage. There are two views. Index and Detail. In index I setup the cookie for user using response.set_cookie('key', key) where response = HttpResponseRedirect(file_url). In detail function when I try to get data from cookie using

   if 'key' not in request.cookies:
      key = request.COOKIES['key']  

I am getting error: 'WSGIRequest' object has no attribute 'cookies'. Detailed error link : http://dpaste.com/1P017V6

Please help me!. Thanks in advance.

like image 473
bewithaman Avatar asked Jan 07 '23 16:01

bewithaman


1 Answers

You typed request.cookies, but cookies must be upper case. Try with this:

if 'key' not in request.COOKIES:
like image 55
LostMyGlasses Avatar answered Jan 15 '23 09:01

LostMyGlasses