python高性能异步框架 Tornado精简教程

第一个demo:,这和其它框架几乎一样,所以不作解释

import tornado.web
import tornado.ioloop
######################################################

class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.write(('hello.wo00rld')) #定义请求函数
#########################################################

if __name__ == "__main__":
application = tornado.web.Application([

(r"/", IndexHandler),


],debug=True)
#############################################################


application.listen(8888) #指定端口
tornado.ioloop.IOLoop.instance().start() #循环监听
######################################################################


猜你喜欢

转载自www.cnblogs.com/fgxwan/p/9992431.html