How to get current url of uwsgi app in Python?

I am 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 would like to know what my current URL is, for example:

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

For some reason this is not in the docs. Did I miss something fundamental here? What should I look for? How to get the current URL?

In addition, how do you get things like:

Cookies, receiving language, headers, etc.

+4
source share
2 answers

Everything is in env , and wsgiref.util can help you get to it. And none of them are specific to uWSGI, which is a WSGI container.

+3
source

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

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

+1
source

Source: https://habr.com/ru/post/1381623/


All Articles