0

我只是在前一段时间运行这个脚本,突然它似乎给了我一个错误。

@app.route('/')
def hello():
    return '''                    
                <form method="POST" action="/people">
                    <font size = "4">I am looking for?</font><br>
                    <font size = 2>Please enter atleast two words. </font><br><br>
                    <input name="search" type="text" width=1000px>
                    <br>
                    <input type="submit" value="People Search"/>
                    <br>
                </form>

                <form method="POST" action="/science">
                    <input name="search" type="text" width=1000px> 
                     <input type="submit" value="Science Search"/>
              </form>'''
@app.route('/people', methods=['POST'])
def PeopleSearch():
        name = request.form.get('search')
        print (name)

它在单击人员搜索时出现内部服务器错误。这只是在不久前起作用。

4

1 回答 1

2

您不返回PeopleSearch端点的响应。下一个代码必须正常工作:

@app.route('/people', methods=['POST'])
def people_search():
    name = request.form.get('search')
    return name
于 2013-08-13T11:35:55.823 回答