Cookies not showing up in environ
useracct222 at gmail.com
Fri Jul 20 15:39:38 EDT 2018
I am trying the simplest of examples below to set and read a cookie. I am using the Django framework, but I have also tried with vanilla python cookies and os.environ. I have posted elsewhere, but this hasn't gotten much attention, so I'd really appreciate any help.
Thinking at this point it may be something to with the server, not python. I have tried uwsgi/nginx, gunicorn/nginx, django development server with no success.
def index(environ, start_response, request):
if not 'HTTP_COOKIE' in environ:
response = HttpResponse("hello")
response.set_cookie('user_agreement', 'cookie text', domain='.mysite.com')
The webpage just prints 'hello' and never reaches the else not matter how many times I refresh the page. There are no cookies in the browser ever either.
Am I missing some middleware? I remember some answers to cookie problems related to the order of their middleware configurations. Here's mine:
MIDDLEWARE = [
More information about the Python-list