import tornado.web import tornado.ioloop li = [] class IndexHandler(tornado.web.RequestHandler): def get(self): self.render('index.html', show_list=li) def post(self, *args, **kwargs): input_value = self.get_argument('input_value') li.append(input_value) self.render('index.html', show_list=li) settings = { 'template_path': 'tpl', 'static_path': 'static', 'static_url_prefix': '/static/', } application = tornado.web.Application([ (r"/index", IndexHandler), ], **settings) if __name__ == '__main__': application.listen(8888) tornado.ioloop.IOLoop.instance().start()
浙公网安备 33010602011771号