222.py 537 B

123456789101112131415
  1. # -*- coding:utf-8 -*-
  2. from app import app
  3. from flask import request
  4. app.test_request_context('/basic').push()#激活请求上下文
  5. from flask import current_app
  6. app.app_context().push()#激活程序上下文
  7. #定义LoginForm类
  8. from wtforms import Form, StringField,PasswordField,BooleanField,SelectField
  9. from wtforms.validators import DataRequired,length
  10. class LoginForm(Form):
  11. username = StringField('Username', validators=[DataRequired()])
  12. password = PasswordField('Password',validators=[DataRequired(),length(8,128)])