按照http://www.tornadoweb.cn/所提供的方法下载安装后编写如下程序:
import tornado.ioloopimport tornado.webclass MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world")class TestHandler(tornado.web.RequestHandler): def get(self): self.write("Hello Evilxr,This is you's Python!")application = tornado.web.Application([ (r"/", MainHandler), (r"/test",TestHandler),])if __name__ == "__main__": application.listen(8888) tornado.ioloop.IOLoop.instance().start()
退出VI 后运行该脚本root@IdeaPad:~/test# python one.py