我已经运行了烧瓶程序一段时间了,突然出现了405方法不允许错误。
Prodsearch.html
<form name="product search" action="" method="post" novalidate>
<fieldset class="form-group">
<legend>Database Search</legend>
{{ form.hidden_tag() }}
<p>
<h6>Search: </h6>
{{ form.input(size=20) }}
<!-- <input type = "file" name = "file" />-->
{% for error in form.input.errors %}
<span class="error-message">{{ error }}</span>
{% endfor %}
</p>
<p>
{{ form.submit(class="btn btn-primary") }}
</p>
</fieldset>
</form>
routes.py
@app.route('/')
@app.route('/Prodsearch', methods=['GET', 'POST'])
@login_required
def prodsearch():
...
return render_template('Prodsearch.html', form=form, vol_data=data)
forms.py
class ProdSearch(FlaskForm):
input = StringField("Enter name search key word", validators=[DataRequired()])
submit = SubmitField("Search")
我不知道为什么这个错误突然发生。任何帮助将不胜感激!
答案 0 :(得分:1)
尝试将第一条路线更改为
@app.route('/', methods=['GET', 'POST'])