#pip install tornado #cat web.py import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.write(‘hello,world!‘) class test(tornado.web.RequestHandler): def get(self): self.write(‘this is testing !‘) application = tornado.web.Application([ # (r"",MainHandler), (r"/",MainHandler), (r"/test",test) ]) if __name__ == "__main__": application.listen(8888) tornado.ioloop.IOLoop.instance().start()
#python web.py
http://IP:8888/
时间: 2024-10-12 04:53:29