今天遇到个很奇怪的问题,flask-socketio本地跑的时候,没有报错,但是一旦部署到线上,就报了 failed: Error during WebSocket handshake: Unexpected response code: 500 的错误。后来查看服务器日志:出现了以下错误:

RuntimeError: You need to use the gevent-websocket server. See the Deployment section of the documentation for more information.

【报错】flask-socketio failed: Error during WebSocket handshake: Unexpected response code: 500
原因:
最新的flask_socketio 使用的是python-socketio
如果在包中安装了gevent或evenlet,在服务器上使用时,就会报错
解决:
查看服务器安装的库,服务器上有,但是我本地没有,这就是问题所在了,卸载gevent和evenlet有关的库,然后重启服务就行了。

pip3 freeze
【报错】flask-socketio failed: Error during WebSocket handshake: Unexpected response code: 500

pip3 uninstall gevent-websocket
pip3 uninstall gevent

相关文章:

  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-08
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
相关资源
相似解决方案