Python Tornado

按照http://www.tornadoweb.cn/所提供的方法下载安装后编写如下程序:

import tornado.ioloop

import tornado.web



class 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 

 Python Tornado

Python Tornado

你可能感兴趣的:(tornado)