Cookies not showing up in environ

Peter J. Holzer hjp-python at hjp.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.
> 
> view.py:
> 
> 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.

        hp

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp at hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20180720/8b1bc88f/attachment.sig>


More information about the Python-list mailing list