Skip to content

Instantly share code, notes, and snippets.

@sdiehl
Created April 13, 2011 06:35
Show Gist options
  • Select an option

  • Save sdiehl/917073 to your computer and use it in GitHub Desktop.

Select an option

Save sdiehl/917073 to your computer and use it in GitHub Desktop.
gevent launch script
#!/usr/bin/env python
import os, sys
from gevent import monkey
monkey.patch_all()
import settings
import django.core.handlers.wsgi
from socketio import SocketIOServer
from django.core.management import setup_environ
setup_environ(settings)
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
application = django.core.handlers.wsgi.WSGIHandler()
PORT = 8000
HOSTNAME = 'localhost'
if __name__ == '__main__':
print('Listening on http://%s:%s' % (HOSTNAME,PORT))
# Start up SocketIOServer, a gevent-pywsgi server which maps the url '/socket.io'
SocketIOServer((HOSTNAME, PORT), application, resource="socket.io").serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment