Cookies not showing up in environ

Peter J. Holzer hjp-python at
Fri Jul 20 16:38:46 EDT 2018

On 2018-07-20 12:39:38 -0700, abc abc wrote:
> 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:

The first argument to a Django view function is the request object,
not anything one could plausibly name "environ". See the django docs on
how to access the fields of a request.


   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp at         | management tools.
__/   | | -- Ross Anderson <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list