使用 gunicorn 启动 flask 的 socketio websocket

创建日期: 2023-08-08 17:40 | 作者: 风波 | 浏览次数: 15 | 分类: Flask

来源: - https://flask-socketio.readthedocs.io/en/latest/deployment.html#gunicorn-web-server - https://flask-socketio.readthedocs.io/en/latest/deployment.html

需要安装的依赖

pip install gunicorn eventlet -i https://mirrors.aliyun.com/pypi/simple/  --trusted-host mirrors.aliyun.com

启动命令

gunicorn --worker-class eventlet -w 1 module:app

报错

  1. class uri 'eventlet' invalid or not found

原因是 eventlet 新版本把 ALREADY_HANDLED 变量删掉,所以需要升级 gunicorn 或者降级 eventlet 参考:https://stackoverflow.com/questions/58589138/error-class-uri-eventlet-invalid-or-not-found

15 浏览
10 爬虫
0 评论