s2.py
import tornado.ioloopimport tornado.webtext_list=[]class MainHandler(tornado.web.RequestHandler): def get(self): self.render('s2.html',xxoo=text_list) def post(self, *args, **kwargs): name= self.get_argument('tex') text_list.append(name) self.render('s2.html',xxoo=text_list)settings={ 'template_path':'tpl', 'static_path': 'static',}application = tornado.web.Application([ (r"/index", MainHandler),],**settings)if __name__ == "__main__": application.listen(8888) tornado.ioloop.IOLoop.instance().start()
s2.html
Title 提交内容
展示内容
- {% for item in xxoo %}
- { {item}} {% end %}