Source

django-socketio-on-dotcloud / socket / wsgi.py

import os
import sys

from django.core.handlers.wsgi import WSGIHandler

from socketio.server import SocketIOServer

PORT = 8080

sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'hellodjango')))
os.environ['DJANGO_SETTINGS_MODULE'] = 'hellodjango.settings'

# Make the port available here for the path:
#   socketio_tags.socketio ->
#   socketio_scripts.html ->
#   io.Socket JS constructor
# allowing the port to be set as the client-side default there.
os.environ["DJANGO_SOCKETIO_PORT"] = str(PORT)


bind = ('127.0.0.1', int(PORT))
print
print "SocketIOServer running on %s:%s" % bind
print
print "Socket.io env: {0}".format(os.environ.get("socketio", 'Empty'))

handler = WSGIHandler()
server = SocketIOServer(bind, handler, resource="socket.io")
server.serve_forever()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.