2
You have to:
-
Set the cookie into the
Response
objectresponse = render(request, 'command.html', {'result': request.META.items()}) response.set_cookie('cookie_name', 'cookie_value') return response
-
Search for the cookie inside
request.COOKIES
if 'cookie_name' in request.COOKIES: cookie_value = request.COOKIES['cookie_name']
0
requests.get(r'http://127.0.0.1:8000/info/').cookies.items())
This looks ok to me. If it returns an empty list, it means that your view is not setting any cookies.
By default, Django only sets the session cookie when the session has been modified. See the Django docs on when sessions are saved for more information.
- [Answered ]-Seemingly quick filter field-lookup is slow
- [Answered ]-Cassandra: occasional permission errors
- [Answered ]-Javascript modules not available templates not inherited from base Django tempate
- [Answered ]-How to get celery task state?
- [Answered ]-Python ImportError: No module named djng
Source:stackexchange.com