chat_server.py 594 B

123456789101112131415161718192021222324
  1. """
  2. chat_server.py - 聊天服务器
  3. """
  4. import os
  5. import tornado.web
  6. import tornado.ioloop
  7. from chat_handlers import LoginHandler, ChatHandler
  8. def main():
  9. app = tornado.web.Application(
  10. handlers=[(r'/login', LoginHandler), (r'/chat', ChatHandler)],
  11. template_path=os.path.join(os.path.dirname(__file__), 'templates'),
  12. static_path=os.path.join(os.path.dirname(__file__), 'static'),
  13. cookie_secret='MWM2MzEyOWFlOWRiOWM2MGMzZThhYTk0ZDNlMDA0OTU=',
  14. )
  15. app.listen(8888)
  16. tornado.ioloop.IOLoop.current().start()
  17. if __name__ == '__main__':
  18. main()