add delayed redirect
This commit is contained in:
parent
ab83fcef30
commit
d9eeb67128
10
app.py
10
app.py
|
@ -89,10 +89,11 @@ def upload_file():
|
||||||
thread.start()
|
thread.start()
|
||||||
print(f"thread started for {file.filename=}")
|
print(f"thread started for {file.filename=}")
|
||||||
|
|
||||||
response = make_response("file uploaded succesfully", 301)
|
return render_template(
|
||||||
response.headers["Location"] = "/"
|
"upload_successful.html",
|
||||||
|
url="/",
|
||||||
return response
|
seconds=3,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/run/<string:cassetta>", methods=["GET"])
|
@app.route("/run/<string:cassetta>", methods=["GET"])
|
||||||
|
@ -102,7 +103,6 @@ def run(cassetta: str):
|
||||||
|
|
||||||
response = make_response(make_response("", 301))
|
response = make_response(make_response("", 301))
|
||||||
response.headers["Location"] = "/"
|
response.headers["Location"] = "/"
|
||||||
response.status_code = 301
|
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
10
templates/upload_successful.html
Normal file
10
templates/upload_successful.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="refresh" content="{{seconds}}; URL='{{url}}'" />
|
||||||
|
<title>Upload successful...</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>You will be redirected to {{url}} in {{ seconds }} seconds.</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user