Flask部署方式gevent加上monkey.patch_all

cooolr 于 2021-08-04 发布
pip install gevent
  1. 使用
from gevent import monkey
from gevent.pywsgi import WSGIServer
monkey.patch_all()
from yourapplicationimport app
 
http_server= WSGIServer(('',5000), app)
http_server.serve_forever()

不加猴子补丁导致接口变成同步程序,比flask默认运行还慢,人间惨剧