V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
sccyzc
V2EX  ›  Python

Python flask + uwsgi flask-sockets 部署出现 KeyError: 'wsgi.websocket'? 有没有使用过 flask-sockets 或者 gevent-websocket 的大佬

  •  
  •   sccyzc · 2020-07-16 16:11:21 +08:00 · 1254 次点击
    这是一个创建于 1544 天前的主题,其中的信息可能已经有所发展或是发生改变。

    [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()
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2480 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 12:34 · PVG 20:34 · LAX 05:34 · JFK 08:34
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.