原因是flask版本过高,降级以后即可成功。(也可以去寻找新版本的写法,临时处理为降级软件包)
Traceback (most recent call last): File "/home/gaojiang/.local/lib/python3.8/site-packages/gevent/pywsgi.py", line 999, in handle_one_response self.run_application() File "/home/gaojiang/.local/lib/python3.8/site-packages/geventwebsocket/handler.py", line 75, in run_application
self.run_websocket() File "/home/gaojiang/.local/lib/python3.8/site-packages/geventwebsocket/handler.py", line 52, in run_websocket list(self.application(self.environ, lambda s, h, e=None: [])) File "/home/gaojiang/.local/lib/python3.8/site-packages/flask/app.py", line 2091, in __call__ return self.wsgi_app(environ, start_response)
File "/home/gaojiang/.local/lib/python3.8/site-packages/flask_sockets.py", line 40, in __call__
handler, values = adapter.match()
File "/home/gaojiang/.local/lib/python3.8/site-packages/werkzeug/routing.py", line 2026, in match
raise WebsocketMismatch()
werkzeug.routing.WebsocketMismatch: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand.
2021-10-22T08:11:08Z {'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '60922', 'HTTP_HOST': '127.0.0.1:5000', (hidden keys: 30)} failed with WebsocketMismatch
pip3 install flask==1.1.2
pip3 install Werkzeug==1.0.2
降级后成功访问