Sorry for the delayed response. Yes, I understand that a cookie must be 
set/sent to the browser after the first request, and that generally you 
must send the cookie headers alone as I've had trouble on other platforms 
trying to send them along with other things. That being said, I need to 
cover the basics.

I first need to make sure I am accessing them correctly. This is as simple 
as it gets I imagine:

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',
]

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/06b0a007-09fd-4476-b100-ac0a504ee297%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to