python uwsgi environ对象中包含的信息

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/JackLiu16/article/details/82822161
####################################################################################################
{'HTTP_COOKIE': 'SL_G_WPT_TO=zh; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1', 'SERVER_SOFTWARE': 'gunicorn/19.9.0', 'SCRIPT_NAME': '', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': 'uid=9&name=jack', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36', 'HTTP_CONNECTION': 'keep-alive', 'REMOTE_PORT': '53784', 'SERVER_NAME': '0.0.0.0', 'REMOTE_ADDR': '192.168.43.1', 'wsgi.url_scheme': 'http', 'SERVER_PORT': '9000', 'wsgi.input': <gunicorn.http.body.Body object at 0x7f6f1ce0c290>, 'HTTP_HOST': '192.168.43.136:9000', 'wsgi.multithread': False, 'HTTP_UPGRADE_INSECURE_REQUESTS': '1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'wsgi.version': (1, 0), 'RAW_URI': '/?uid=9&name=jack', 'wsgi.run_once': False, 'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f6f1ce0c3d0>, 'wsgi.multiprocess': True, 'HTTP_ACCEPT_LANGUAGE': 'zh-CN,zh;q=0.9', 'gunicorn.socket': <socket._socketobject object at 0x7f6f1d055980>, 'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>, 'HTTP_ACCEPT_ENCODING': 'gzip, deflate'}
####################################################################################################
myre:<bound method Response.write of <gunicorn.http.wsgi.Response object at 0x7f6f1ce0c150>>
myresponse:<bound method Response.start_response of <gunicorn.http.wsgi.Response object at 0x7f6f1ce0c150>>
####################################################################################################
{'HTTP_REFERER': 'http://192.168.43.136:9000/?uid=9&name=jack', 'SERVER_SOFTWARE': 'gunicorn/19.9.0', 'SCRIPT_NAME': '', 'REQUEST_METHOD': 'GET', 'PATH_INFO': '/favicon.ico', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': '', 'HTTP_USER_AGENT': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE': 'SL_G_WPT_TO=zh; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1', 'SERVER_NAME': '0.0.0.0', 'REMOTE_ADDR': '192.168.43.1', 'wsgi.url_scheme': 'http', 'SERVER_PORT': '9000', 'REMOTE_PORT': '53785', 'wsgi.input': <gunicorn.http.body.Body object at 0x7f6f1ce0c150>, 'HTTP_HOST': '192.168.43.136:9000', 'wsgi.multithread': False, 'HTTP_ACCEPT': 'image/webp,image/apng,image/*,*/*;q=0.8', 'wsgi.version': (1, 0), 'RAW_URI': '/favicon.ico', 'wsgi.run_once': False, 'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f6f1ce0c190>, 'wsgi.multiprocess': True, 'HTTP_ACCEPT_LANGUAGE': 'zh-CN,zh;q=0.9', 'gunicorn.socket': <socket._socketobject object at 0x7f6f1d055980>, 'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>, 'HTTP_ACCEPT_ENCODING': 'gzip, deflate'}
####################################################################################################
myre:<bound method Response.write of <gunicorn.http.wsgi.Response object at 0x7f6f1ce0c250>>
myresponse:<bound method Response.start_response of <gunicorn.http.wsgi.Response object at 0x7f6f1ce0c250>>

#coding=utf-8
import os


def app(environ, start_response):
        print "#"*100
        print environ
        print "#"*100
        data = b"Hello, World!\n"
        re = start_response("200 OK", [
            ("Content-Type", "text/plain"),
            ("Content-Length", str(len(data)))
        ])
        print "{}:{}".format("myre",re)
        print "{}:{}".format("myresponse",start_response)
        return iter([data])

gunicorn -w 2 -b 0.0.0.0:9000 tguni:app

uwsgi environ对象中包含的信息

猜你喜欢

转载自blog.csdn.net/JackLiu16/article/details/82822161
今日推荐