所以我在 Flask 上运行了这个 python 页面。它工作得很好,直到我想要重定向。
@app.route("/last_visit")
def check_last_watered():
templateData = template(text = water.get_last_watered())
return render_template('main.html', **templateData)
return redirect(url_for('new_page')) #with a delay here of 3 secs
该网站工作正常,但不重定向,我不知道如何延迟整个事情。
想法...请:-)
如果您需要渲染模板并在三秒后重定向,您可以通过refresh
随着时间和url
以及您需要重定向的 URL。
@app.route('/error/', methods=['GET'])
def error():
return render_template('error.html'), {"Refresh": "1; url=https://google.com"}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)