Created
April 13, 2011 06:35
-
-
Save sdiehl/917073 to your computer and use it in GitHub Desktop.
gevent launch script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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