I am trying to redirect a user to a web page with a loading spinner using render_template and then redirect them to an external URL using flask
in Python.
(我正在尝试使用render_template使用加载微调器将用户重定向到网页,然后使用Python flask
将用户重定向到外部URL。)
I have written the code below, it only waits 3 seconds and then redirects to youtube.com
.
(我已在下面编写了代码,它仅等待3秒钟,然后重定向到youtube.com
。)
from flask import Flask, redirect, render_template
from time import sleep
app = Flask(__name__)
@app.route('/')
def redirect_to_url():
render_template('loading_spinner.html')
sleep(3)
return redirect("https://youtube.com")
if __name__ == "__main__":
app.run(debug=True)
Does anyone have any ideas on how to achieve this?
(有人对如何实现这一目标有任何想法吗?)
ask by Anatol translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…