Python 按html上的按钮,Flask不';我什么也不做
我有一个只有一个按钮的网站。当按下按钮时,我想用烧瓶把信息传出去Python 按html上的按钮,Flask不';我什么也不做,python,html,flask,request,vps,Python,Html,Flask,Request,Vps,我有一个只有一个按钮的网站。当按下按钮时,我想用烧瓶把信息传出去 from flask import Flask from flask import render_template from flask import request app = Flask(__name__) @app.route("/") def index(): return render_template('index.html') @app.route("/") def login(): if re
from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
@app.route("/")
def index():
return render_template('index.html')
@app.route("/")
def login():
if request.method == 'POST':
return 'yes it works'
if __name__ == "__main__":
app.run(debug=True)
知道为什么什么都没发生吗?为什么当我按下按钮时,我并没有收到信息“是的,它能工作”
html
无标题页
两件事
@app.route("/")
def index():
return render_template('index.html')
@app.route("/login", methods=['POST'])
def login():
if request.method == 'POST':
return 'yes it works'
html将按钮包装在
元素中
<body>
<form action="/login" method="post">
<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:382px;top:298px;width:96px;height:25px;z-index:0;">
</form>
</body>
<body>
<form action="/login" method="post">
<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:382px;top:298px;width:96px;height:25px;z-index:0;">
</form>
</body>