What if you look in 'request.COOKIES'?

Graham

> On 10 Jul 2018, at 5:39 pm, at_your_mercy <[email protected]> wrote:
> 
> I suppose this could have gone in the Django group, but the problem starts in 
> WSGI, so I'll try here first. I've followed numerous examples, but the only 
> one that does not return errors are the implementations of the two functions 
> below. There doesn't seem to be an HTTP_COOKIE key in the environ. The 
> request value only gets set with POST and GET. Think something is wrong with 
> my setup, because none of the common usage patterns I've seen online like 
> request.POST don't work.
> 
> 
> view.py
> 
> def index(environ, start_response, request):
>     print request
>     print environ.keys()
>     template = loader.get_template('index-test.html')
>     response = HttpResponse(template.render(None))
>     response.set_cookie('name1', 'test-cookie')
>     response.set_cookie('name2', 'test-cookie')
>     return response
> 
> 
> wsgi.py:
> 
> def application(environ, start_response):
>     try:
>         request_body_size = int(environ.get('CONTENT_LENGTH', 0))
>     except (ValueError):
>         request_body_size = 0
>     request_body = environ['wsgi.input'].read(request_body_size)
>     request = parse_qs(request_body)
> 
>     start_response('200 OK', [('Content-Type', 'text/html')])
>     return omicron.view.index(environ, start_response, request)
> 
> OUTPUT:
> 
> request: {}
> 
> environ.keys():
> ['RUN_MAIN', 'HTTP_REFERER', 'XDG_GREETER_DATA_DIR', 'QT4_IM_MODULE', 
> 'SERVER_SOFTWARE', 'UPSTART_EVENTS', 'SCRIPT_NAME', 'XDG_SESSION_TYPE', 
> 'REQUEST_METHOD', 'CONTENT_LENGTH', 'SERVER_PROTOCOL', 'HOME', 'DISPLAY', 
> 'LANG', 'SHELL', 'PATH_INFO', 'XDG_DATA_DIRS', 
> 'QT_LINUX_ACCESSIBILITY_ALWAYS_ON', 'MANDATORY_PATH', 
> 'COMPIZ_CONFIG_PROFILE', 'UPSTART_INSTANCE', 'JOB', 'SESSION', 
> 'LIBGL_ALWAYS_SOFTWARE', 'SERVER_PORT', 'CLUTTER_IM_MODULE', 'XMODIFIERS', 
> 'GTK2_MODULES', 'HTTP_PRAGMA', 'XDG_RUNTIME_DIR', 'COMPIZ_BIN_PATH', 
> 'VTE_VERSION', 'HTTP_CACHE_CONTROL', 'HTTP_CONNECTION', 'HTTP_HOST', 
> 'wsgi.version', 'XDG_CURRENT_DESKTOP', 'XDG_SESSION_ID', 
> 'DBUS_SESSION_BUS_ADDRESS', 'GNOME_KEYRING_PID', 'HTTP_ACCEPT', 
> 'DESKTOP_SESSION', 'LESSCLOSE', 'DEFAULTS_PATH', 'wsgi.run_once', 
> 'wsgi.errors', 'wsgi.multiprocess', 'HTTP_ACCEPT_LANGUAGE', 'INSTANCE', 
> 'LS_COLORS', 'XDG_SEAT', 'GNOME_DESKTOP_SESSION_ID', 'LESSOPEN', 
> 'QUERY_STRING', 'QT_IM_MODULE', 'LOGNAME', 'USER', 'GNOME_KEYRING_CONTROL', 
> 'XDG_VTNR', 'PATH', 'TERM', 'HTTP_USER_AGENT', 'XDG_SESSION_PATH', 
> 'XAUTHORITY', 'LANGUAGE', 'REMOTE_ADDR', 'SHLVL', 'QT_QPA_PLATFORMTHEME', 
> 'wsgi.url_scheme', 'QT_ACCESSIBILITY', 'WINDOWID', 'SESSIONTYPE', 
> 'IM_CONFIG_PHASE', 'GPG_AGENT_INFO', 'XDG_SESSION_DESKTOP', 'SSH_AUTH_SOCK', 
> 'GDMSESSION', 'UPSTART_JOB', 'wsgi.multithread', 'XDG_SEAT_PATH', 'TZ', '_', 
> 'wsgi.input', 'GTK_IM_MODULE', 'UPSTART_SESSION', 'XDG_CONFIG_DIRS', 
> 'SERVER_NAME', 'GATEWAY_INTERFACE', 'OLDPWD', 'GDM_LANG', 'GTK_MODULES', 
> 'PWD', 'DJANGO_SETTINGS_MODULE', 'CONTENT_TYPE', 'wsgi.file_wrapper', 
> 'REMOTE_HOST', 'HTTP_ACCEPT_ENCODING']
> 
> You can see their is no HTTP_COOKIE in the keys.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to