flask如何解决同时请求同一个请求的阻塞问题
1 回答
慕斯王
TA贡献1864条经验 获得超2个赞
from gevent import monkeyfrom gevent.pywsgi import WSGIServer
monkey.patch_all()from flask import Flaskimport time
app = Flask(__name__)@app.route('/test',methods=['GET'])def sayHello():
time.sleep(10) return 'hello'@app.route('/hi',methods=['GET'])def sayHi():
return 'hi'if __name__ =='__main__':
http_server = WSGIServer(('', 5000), app)
http_server.serve_forever()
- 1 回答
- 0 关注
- 1422 浏览
添加回答
举报
0/150
提交
取消