Kakedis
Kakedis

Reputation: 182

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. 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.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. 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?

Upvotes: 2

Views: 1582

Answers (1)

Eddie
Eddie

Reputation: 54421

Check your gunicorn configuration. it looks like you have a post_request handler in place that is logging the environment dictionary after every request finishes. Look for code something like this in your gunicorn configuration:

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

If you can find it, that is what is causing those log lines.

Upvotes: 1

Related Questions