开发环境:
$ pip install tornado
简单的示例程序:
1 import tornado.ioloop 2 import tornado.web 3 4 class MainHandler(tornado.web.RequestHandler): 5 def get(self): 6 self.write('Hello World') 7 8 9 def make_app(): 10 return tornado.web.Application([ 11 (r'/', MainHandler), 12 ]) 13 14 15 if __name__ == '__main__': 16 app = make_app() 17 app.listen(8888) 18 tornado.ioloop.IOLoop.current().start()