我有一个带有简单文本的页面和一个表单中的按钮
<html>
<head>
</head>
<body>
<h1>JASON</h1>
<form>
<button type="submit" formmethod="POST">Activate</button>
<br>
<input type="hidden" value="act.12344" name="sub" />
</form>
</body>
</html>
而这个python脚本
from flask import Flask, render_template, request, redirect
app = Flask(__name__)
@app.route('/atdt', methods=['GET', 'POST'])
def atdt():
if request.method == 'POST':
print('post')
requested = request.form['sub']
ver = str(requested).split('.')
if ver[0] == 'act':
print('act')
modif(ver[1]) #this func modifies the index page
return render_template('index.html')
else:
return render_template('index.html')
脚本的重点是将名称 jason 更改为其他内容......而且效果很好,页面已更改,一切都很好
但是我的烧瓶程序不会显示它......“.html”页面已更改,如果我手动打开它,它可以在程序之外工作!
但是如果我给python这条线return render_template('index.html')但它不会呈现它如果我尝试手动刷新它只会向我显示旧页面
有什么帮助吗?