图解Tornado框架 | python

1.简单的Tornado示例

import tornado.web
import tornado.ioloop


class IndexView(tornado.web.RequestHandler):
    def get(self):
        self.write("hello world!")


if __name__ == "__main__":
    app = tornado.web.Application([
        (r'/', IndexView),
    ])
    app.listen(8000)
    tornado.ioloop.IOLoop.current().start()
Tornado简单示例

猜你喜欢

转载自www.cnblogs.com/pymkl/p/9238126.html