Skip to content

Commit

Permalink
Make gevent websocket optional in example app
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Aug 20, 2015
1 parent 48eb073 commit c6b1ae9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions example/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ def disconnect(sid):
elif async_mode == 'gevent':
# deploy with gevent
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
pywsgi.WSGIServer(('', 5000), app,
handler_class=WebSocketHandler).serve_forever()
try:
from geventwebsocket.handler import WebSocketHandler
websocket = True
except ImportError:
websocket = False
if websocket:
pywsgi.WSGIServer(('', 5000), app,
handler_class=WebSocketHandler).serve_forever()
else:
pywsgi.WSGIServer(('', 5000), app).serve_forever()
else:
print('Unknown async_mode: ' + async_mode)

0 comments on commit c6b1ae9

Please sign in to comment.