Flask-web实现Python小问题汇总

1.python3中无unicode,已经变成str

 
405 Method Not Allowed

Method Not Allowed

The method is not allowed for the requested URL.

本地测试Flask项目程序的时候遇到的,原因有可能是你的此条route('url')少了第二个参数,或者比如你使用post方式获取,但是并没有声明post
  File "/Users/lovehxy/.virtualenvs/flask/lib/python3.4/site-packages/wtforms/fields/core.py", line 175, in validate
    stop_validation = self._run_validation_chain(form, chain)
  File "/Users/lovehxy/.virtualenvs/flask/lib/python3.4/site-packages/wtforms/fields/core.py", line 195, in _run_validation_chain
    validator(form, self)
TypeError: __init__() takes from 1 to 2 positional arguments but 3 were given

原因是:DataRequired需要加上()
email = StringField('email',validators=[DataRequired()])

你可能感兴趣的:(Flask-web实现Python小问题汇总)