Example #1
0
def run():
    """Run standalone http server.
    """
    app = Flask(__name__)

    # Bind to mysql, and generate mapping.
    db.bind("mysql",
            host="localhost",
            port=3306,
            user="******",
            passwd="123456",
            db="threads")
    db.generate_mapping(check_tables=True, create_tables=False)

    # Register blueprint.
    app.register_blueprint(thread_app)

    if "DEBUG" in os.environ:
        app.run(port=8888, debug=True)
    else:
        app.run(port=8888)
Example #2
0
def run():
    """Run standalone sockjs server.
    """
    # Bind to mysql, and generate mapping.
    db.bind("mysql", host="localhost", port=3306, user="******", passwd="123456", db="threads")
    db.generate_mapping(check_tables=True, create_tables=False)

    reader = nsq.Reader(
        lookupd_http_addresses=[NsqConfig.NSQ_LOOKUP_ADDRESS],
        topic=NsqTopic.NSQ_INBOX_TOPIC,
        channel="chat",
        lookupd_poll_interval=15,
    )
    reader.set_message_handler(handle_boardcast_message)
    app = tornado.web.Application(urls)
    port = os.environ.get("PORT", 9999)
    port = int(port)
    app.listen(port)

    nsq.run()
    tornado.ioloop.IOLoop.instance().start()
Example #3
0
def run():
    """Run standalone http server.
    """
    app = Flask(__name__)

    # Bind to mysql, and generate mapping.
    db.bind("mysql",
            host="localhost",
            port=3306,
            user="******",
            passwd="123456",
            db="threads")
    db.generate_mapping(check_tables=True,
                        create_tables=False)

    # Register blueprint.
    app.register_blueprint(thread_app)

    if "DEBUG" in os.environ:
        app.run(port=8888, debug=True)
    else:
        app.run(port=8888)
Example #4
0
def run():
    """Run standalone sockjs server.
    """
    # Bind to mysql, and generate mapping.
    db.bind("mysql",
            host="localhost",
            port=3306,
            user="******",
            passwd="123456",
            db="threads")
    db.generate_mapping(check_tables=True, create_tables=False)

    reader = nsq.Reader(lookupd_http_addresses=[NsqConfig.NSQ_LOOKUP_ADDRESS],
                        topic=NsqTopic.NSQ_INBOX_TOPIC,
                        channel="chat",
                        lookupd_poll_interval=15)
    reader.set_message_handler(handle_boardcast_message)
    app = tornado.web.Application(urls)
    port = os.environ.get("PORT", 9999)
    port = int(port)
    app.listen(port)

    nsq.run()
    tornado.ioloop.IOLoop.instance().start()