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. view.py: 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') return response else: print environ['HTTP_COOKIE'] 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 = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] -- https://mail.python.org/mailman/listinfo/python-list