-1👍
Another solution for this issue is to directly work with a SimpleCookie object and attach it to your response
>>> from Cookie import SimpleCookie
>>> mycookie = SimpleCookie()
>>> mycookie['emailaddress'] = 'josuebrunel@gmail.com'
>>> mycookie['emailaddress']['expires'] = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
>>> print(mycookie)
Set-Cookie: emailaddress="josuebrunel@gmail.com"; expires=2015-11-25 22:20:16
>>> response.cookies = mycookies
I had the same issue, and i fixed by using SimpleCookie
- [Django]-Django Cannot Connect to SQL Server 2019
- [Django]-Django "Did you mean?" query
- [Django]-Delete() an instance
- [Django]-Polls application — django tutorial not working
Source:stackexchange.com