PHPz2017-04-17 17:04:42
Use Unicode internally, such as:
submit = SubmitField(u'登陆')
The template file must be saved in UTF-8 format encoding.
黄舟2017-04-17 17:04:42
Add this code before the python file
import sys
default_encoding = 'utf-8'
if sys.getdefaultencoding() != default_encoding:
reload(sys)
sys.setdefaultencoding(default_encoding)
PHPz2017-04-17 17:04:42
Suddenly I realized that what I wrote was a stupid method,
email=StringField('电子邮箱‘.decode('utf-8'),validators=[Required(),Length(1,64),Email()])
password=PasswordField('密码'.decode('utf-8'),validators=[Required()])
remember_me=BooleanField('记住我?'.decode('utf-8'))