This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Application(tornado.web.Application): | |
def __init__(self): | |
tornado.web.Application.__init__(self, handlers, **settings) | |
self.db_session = db_session | |
self.redis = redis.StrictRedis() | |
self.session_store = RedisSessionStore(self.redis) | |
class BaseHandler(tornado.web.RequestHandler): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wtforms import Form | |
定义一个类,目的用于获取html的form中的值 | |
class RegistrationForm(Form): | |
name = TextField('name', [validators.Length(min=4, max=25)]) | |
这个是处理方法,目的是打印获取的值 | |
class ReciveData(RequestHandler): | |
def post(self): | |
form = RegistrationForm() |