コード例 #1
0
ファイル: server.py プロジェクト: smerkousdavid/rem-sphinx
                        'path': less_dir
                    })]

        settings = {"template_path": "templates"}

        Application.__init__(self, handlers, **settings)


if __name__ == "__main__":
    # Parse command line options for the tornado web server
    options.parse_command_line()

    # Create the AudioServer wrapped tornado application
    application = AudioServer()

    # Check wether if we're using ssl and load the appropriate settings
    if ssl_configs["use"]:
        server = HTTPServer(application, ssl_options=ssl_configs)
    else:
        server = HTTPServer(application)

    # Get the current server port from the configuration files
    server_port = configs.get_server()["port"]

    # Set the tornado server's endpoint
    server.listen(server_port)
    log.info("Listening on port %d" % server_port)

    # Start the tornado server loop
    IOLoop.instance().start()