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()
|
||||
print(f"thread started for {file.filename=}")
|
||||
|
||||
response = make_response("file uploaded succesfully", 301)
|
||||
response.headers["Location"] = "/"
|
||||
|
||||
return response
|
||||
return render_template(
|
||||
"upload_successful.html",
|
||||
url="/",
|
||||
seconds=3,
|
||||
)
|
||||
|
||||
|
||||
@app.route("/run/<string:cassetta>", methods=["GET"])
|
||||
|
@ -102,7 +103,6 @@ def run(cassetta: str):
|
|||
|
||||
response = make_response(make_response("", 301))
|
||||
response.headers["Location"] = "/"
|
||||
response.status_code = 301
|
||||
|
||||
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