【发布时间】:2017-04-24 21:16:32
【问题描述】:
我有一个只有一个按钮的网站。按下按钮时,我想使用 Flask 获取消息。
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Page</title>
<meta name="generator" content="WYSIWYG Web Builder 11 - http://www.wysiwygwebbuilder.com">
<link href="{{ url_for('static', filename='css/Untitled3.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='css/index.css') }}" rel="stylesheet">
</head>
<body>
<input type="submit" id="Button1" name="" value="Submit" style="position:absolute;left:382px;top:298px;width:96px;height:25px;z-index:0;">
</body>
</html>
【问题讨论】:
标签: python html flask request vps