烧瓶形式不发布

时间:2019-05-28 22:54:27

标签: python python-3.x flask

我在烧瓶中创建了一个简单的表单,我正在尝试将表单数据放入我的app.py中,但是我目前不确定自己做错了什么,因为我什么时候都没有收到任何信息点击搜索按钮。

这是我的代码;

@app.route('/', methods=['POST', 'GET'])
def main():
    if request.method == 'POST':
        print("post working")
        _radius = request.form['radius']
        _postcode = request.form['postcode']
        print(_radius, _postcode) # This does not print so the POST method is not working
        return render_template("Tails.html", LocationData = _searchfunctionality(_radius, _postcode))
    else:
        print("default working")
        return render_template('Tails.html', LocationData = _longitudelatitude())

HTML;

<form action="/" method="POST">
   <input type="text" name = "radius" placeholder="Radius">
   <input type="text" name = "postcode" placeholder="Postcode">
   <button type="button">Search stores</button>
</form>

任何对此的帮助/建议,将不胜感激。

0 个答案:

没有答案