Wednesday, 18 September 2013

Using gunicorn raises KeyError wsgi.websocket

Using gunicorn raises KeyError wsgi.websocket

I am not familiar with gunicorn and system administration and trying to
deploy it on server.
Running of process is very easy and I did it using command
gunicorn -c gunicorn_config.py --bind 127.0.0.1:8000 -k gevent_wsgi
--daemon wsgi:app
gunicorn_config.py
workers = 2
worker_class = 'socketio.sgunicorn.GeventSocketIOWorker'
transports = ['websockets', 'xhr-polling']
bind = '127.0.0.1:8000'
pidfile = '/tmp/gunicorn.pid'
debug = False
loglevel = 'info'
errorlog = '/tmp/gunicorn.log'
resource = "socket.io"
wsgi.py
import os.path as op
import werkzeug.serving
import gevent.monkey
gevent.monkey.patch_all()
from bakery import create_app, init_app
app = create_app(app_name='bakery')
app.config.from_object('config')
app.config.from_pyfile(op.join(op.realpath(op.dirname(__name__)),
'local.cfg'))
init_app(app)
from socketio.server import SocketIOServer
SocketIOServer(('0.0.0.0', 5000), app,
resource="socket.io", policy_server=True,
transports=['websocket', 'xhr-polling'],
).serve_forever()
nginx is set up to use in location
proxy_pass http://localhost:8000
gunicorn successfully runs but after several manipulation on app it
crashes with KeyError 'wsgi.websocket'. Seems that transport websocket is
not enough for that, but I am not sure.

No comments:

Post a Comment