简体   繁体   English

Gunicorn Python 3.7 Flask 1.1 出现 WSGI 错误

[英]WSGI Error with Gunicorn Python 3.7 Flask 1.1

I've recently upgraded from python 2.7 to python 3.7 running Python Flask 1.1.1 and using gunicorn.我最近从 python 2.7 升级到 python 3.7 运行 Python Z9784E91C7B216579197221BC。 Everything seems to run as intended, but every time I load a page in my application I get wsgi errors similar to the following error;一切似乎都按预期运行,但每次我在应用程序中加载页面时,都会收到类似于以下错误的 wsgi 错误;

{'wsgi.errors': <gunicorn.http.wsgi.WSGIErrorsWrapper object at [Object]>, 'wsgi.version': (1, 0), 'wsgi.multithread': False, 'wsgi.multiprocess': False, 'wsgi.run_once': False, 'wsgi.file_wrapper': <class 'gunicorn.http.wsgi.FileWrapper'>, 'wsgi.input_terminated': True, 'SERVER_SOFTWARE': 'gunicorn/20.0.4', 'wsgi.input': <gunicorn.http.body.Body object at [Object]>, 'gunicorn.socket': <socket.socket fd=11, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 8000), raddr=('127.0.0.1', 46186)>, 'REQUEST_METHOD': 'GET', 'QUERY_STRING': '', 'RAW_URI': ..... <bound method Response.start_response of <gunicorn.http.wsgi.Response object at [Object]>>

As I mentioned similar errors get produced every time I access any application page.正如我提到的,每次访问任何应用程序页面时都会产生类似的错误。 The actually error message embedded in the wsgi.error object is slightly different based on the queries etc. being call on the page. wsgi.error object 中嵌入的实际错误消息根据页面上调用的查询等略有不同。 These errors does not seem to be critical, but its filling up my logs.这些错误似乎并不严重,但它填满了我的日志。 Can someone tell me why I'm receiving these errors as output on my web server and if there is a way to fix it?有人能告诉我为什么在我的 web 服务器上收到这些错误为 output 吗?是否有办法解决?

Check your gunicorn configuration.检查您的 gunicorn 配置。 it looks like you have a post_request handler in place that is logging the environment dictionary after every request finishes.看起来您有一个post_request处理程序,它在每个请求完成后记录环境字典。 Look for code something like this in your gunicorn configuration:在你的 gunicorn 配置中寻找类似这样的代码:

def post_request(worker, req, environ, resp):
    worker.log.debug(environ)

If you can find it, that is what is causing those log lines.如果你能找到它,那就是导致这些日志行的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM