예제 #1
0
def main(port, shell):
    """Create and setup a new tornado server."""
    LOGGER.info("Server is now at: 127.0.0.1:{}".format(port))
    LOGGER.info('Shell: {0}'.format(shell))
    application = create_app(shell)
    ioloop = tornado.ioloop.IOLoop.instance()
    application.listen(port, address='127.0.0.1')
    try:
        ioloop.start()
    except KeyboardInterrupt:
        pass
    finally:
        LOGGER.info("Closing server...\n")
        application.term_manager.shutdown()
        tornado.ioloop.IOLoop.instance().stop()
예제 #2
0
 def get_app(self):
     """Return HTTP/WS server."""
     self.close_future = Future()
     return create_app(SHELL, self.close_future)