Question

I'm using this uwsgi app: http://projects.unbit.it/uwsgi/wiki

def application(env, start_response):
  start_response('200 OK', [('Content-Type','text/html')])
  return "Hello World"

I'd like to know what my current URL is, for example:

localhost:9090/some/path/here?a=b&c=d

For some reason this isn't in the docs. Am I missing something fundamental here? What should I be looking up? How do I get the current URL?

Also, how do you get stuff like:

Cookies, Accept Language, Headers, etc.

Was it helpful?

Solution

It's all in env, and wsgiref.util can help you get to it. And none of it is specific to uWSGI, which is just a WSGI container.

OTHER TIPS

Most (if not all) servers is based on Apache (grandaddy). The environment is standardized.

Try: env['HTTP_HOST'], env['PATH_INFO'], env['HOST_NAME'], env['REQUEST_METHOD'], env['REQUEST_URI']

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top