Python Post请求时不允许使用Flask 405错误方法
我已经运行了一段时间的flask程序,突然出现了405 method not allowed错误 Prodsearch.htmlPython Post请求时不允许使用Flask 405错误方法,python,flask,post,routes,http-status-code-405,Python,Flask,Post,Routes,Http Status Code 405,我已经运行了一段时间的flask程序,突然出现了405 method not allowed错误 Prodsearch.html <form name="product search" action="" method="post" novalidate> <fieldset class="form-group"> <legend&
<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>
forms.py
class ProdSearch(FlaskForm):
input = StringField("Enter name search key word", validators=[DataRequired()])
submit = SubmitField("Search")
我不知道为什么这个错误突然不知从何而来。任何帮助都将不胜感激 尝试将第一条路线更改为
@app.route('/', methods=['GET', 'POST'])
在浏览器中打开“/Prodsearch”时会发生什么情况?它会正确打开。它仅在提交post请求时中断。请尝试将第一个路由更改为
@app.route('/',methods=['GET','post'])
Cool,
@app.route('/', methods=['GET', 'POST'])