【发布时间】:2017-06-03 15:16:22
【问题描述】:
我有一个非常简单的 HTML 提交按钮,但它不起作用。
main_page.html
<form class="main_page" method="POST" action=".">
<div class="form-row">
<input type="submit" name="invoer" value="Invoeren"/>
</div>
</form>
flask_app.py
from flask import Flask, render_template, request
app = Flask(__name__)
app.config["DEBUG"] = True
@app.route("/", methods=["GET", "POST"])
def main():
if request.method == "GET":
return render_template("main_page.html")
if request.form["invoer"] == "POST":
return render_template("main_page.html")
当我点击按钮时,它会显示:
----------------------------------- -------------------------------------------------- ----------------------------------
我之前已经制作了一个这样的按钮,但后来它起作用了,也许我做了一些不同的事情。我该怎么办?
【问题讨论】:
-
1.你也看过日志吗? 2. 那真的是你的 HTML 吗?明显坏了。
-
1.是的,我已经这样做了,但它给了我这个pastebin.com/pZE0KY3E,我不知道为什么以及这意味着什么。 2. HTML只是完整html文件的一部分,我添加了复制时错过的''
-
在问题中输入minimal reproducible example。
-
都在那里。
标签: python html flask pythonanywhere