Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
HollaBackYo Broken ToRELPServer
def serve_forever(listen_uri, mongodb_uri):
import urlparse
from pymongo import uri_parser
application = tornado.web.Application([
(r'/', MainHandler)
listen = urlparse.urlparse(listen_uri)
server = tornado.httpserver.HTTPServer(application)
server.bind(port=listen.port or 8888, address=listen.hostname or '')
torelpserver = MyToRELPServer()
torelpserver.bind(port=20514, address='')
conn = motor.MotorConnection(host=mongodb_uri, document_class=MongoOrderedDict).open_sync()
mongodb = uri_parser.parse_uri(mongodb_uri, conn.port)
db = conn[mongodb['database'] or 'hollabackyo']
application.settings['conn'] = conn
application.settings['db'] = db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment