来源: - 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
--worker-class- 指定使用eventlet--threads 100- 线程数量100-w 1- 工作进程数量 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