server.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:board-games-app 作者: sampathweb 项目源码 文件源码
def main():
    """Creates Tornado Application and starts the IO Loop
    """

    # Get the Port and Debug mode from command line options
    options.parse_command_line()

    # create logger for app
    logger = logging.getLogger('app')
    logger.setLevel(logging.INFO)

    FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
    logging.basicConfig(format=FORMAT)

    tic_tac_toe_game_manager = TicTacToeGameManager()

    urls = [
        (r"/$", IndexHandler),
        (r"/tic-tac-toe$", TicTacToeHandler),
        (r"/tic-tac-toe/ws$", TicTacToeSocketHandler, dict(game_manager=tic_tac_toe_game_manager))
    ]

    # Create Tornado application
    application = tornado.web.Application(
        urls,
        debug=options.debug,
        autoreload=options.debug,
        **settings)

    # Start Server
    logger.info("Starting App on Port: {} with Debug Mode: {}".format(options.port, options.debug))
    application.listen(options.port)
    tornado.ioloop.IOLoop.current().start()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号