清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#! /usr/bin/env python import tornado.ioloop import tornado.web from tornado.escape import json_encode status_success = { "status": True, "value":1 } status_fail = { "status": False, "value":2 } class MainHanlder(tornado.web.RequestHandler): def get(self): self.render("index.html") class AjaxHandler(tornado.web.RequestHandler): def post(self): username = self.get_argument("username") password = self.get_argument("password") email = self.get_argument("email") new_member = { "username": username, "password": password, "email": email } # if Member.add_member(new_member): # print(status_success) # print status_success # self.write(json_encode(status_success)) self.write(json_encode(status_fail)) application = tornado.web.Application([ (r"/",MainHanlder), (r"/test", AjaxHandler) ]) if __name__ == '__main__': application.listen(8888) tornado.ioloop.IOLoop.instance().start()