Problem:

 - content length mismatched(ERR_CONTENT_LENGTH_MISMATCH)

 - response string truncated (cut off)


If you are using flask with gevent monkey patch all and you got such a problem above, 

than you should use gevent wsgi instead of flask app.run


For example..

from gevent import monkey

monkey.patch_all()

from flask import Flask

from gevent import wsgi


app = Flask(__name__)


@app.route('/')

def index():

  return 'Hello World'


server = wsgi.WSGIServer(('127.0.0.1', 5000), app)

server.serve_forever()

reason:

flask is not for aysnc future model, so if you want to use asynchronous for http or any socket use, than you should use gevent wsgi

'python' 카테고리의 다른 글

python3 flask + pymongo + gevent, locust testing hangs  (0) 2017.09.26
gevent monkey patch all, code location  (0) 2017.09.14
flask gevent spawn use a lot of memory  (0) 2017.04.05
websocket with gunicorn  (0) 2017.03.03
gunicorn vs uwsgi  (0) 2017.01.20
블로그 이미지

시간을 거스르는자

ytkang86@gmail.com

,