[uwsgi] uid=root gid=root socket = 0.0.0.0:9024 chdir=/root/test-scc/scc_service master=true vhost = True workers = 2 enable-threads = True wsgi-file= run.py callable = flask_app module=run:flask_app logto=/var/error.log python-autoreload=1 touch-chain-reload = true uwsgi_read_timeout = 600 limit-as = 6048 processes=4 gevent= 100
采用 uwsgi 部署成功后: 1.http 接口可以正常访问 2.ws 接口异常:environment = environ['wsgi.websocket'] KeyError: 'wsgi.websocket' 如下方式启动服务不会出现上诉问题: if name == 'main': from gevent import pywsgi from geventwebsocket.handler import WebSocketHandler
host, port, debug = configuration.get_start_config()
flask_app.debug = eval(debug)
server = pywsgi.WSGIServer((host, int(port)), flask_app, handler_class=WebSocketHandler)
server.serve_forever()