提交表单后,尝试将我的Web应用程序重定向到主页,但它只在地址栏中提供了表单的查询。例如/ form?Name = input&Location = input
script.py
@app.route("/")
def home():
return render_template("index.html")
@app.route("/form", methods=["POST", "GET"])
def form():
if request.method == "GET":
return render_template("form.html")
else:
return redirect(url_for("home"))
form.html
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form >
<input type="text" name="Name">
<input type="text" name="Location">
<input type="submit" value="submit">
</form>
</body>
</html>