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()
评论列表
文章目录