2022-02-14 11:13:33 +03:00
|
|
|
from app import app
|
2022-10-09 17:30:07 +03:00
|
|
|
from flask import redirect, Response
|
2020-08-27 10:07:46 +03:00
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
|
2022-10-09 17:30:07 +03:00
|
|
|
@app.route("/redirect-absolute")
|
|
|
|
def redirect_absolute():
|
2022-02-05 08:56:33 +03:00
|
|
|
return redirect("http://localhost:8000/redirected")
|
|
|
|
|
2020-08-27 10:07:46 +03:00
|
|
|
|
2022-10-09 17:30:07 +03:00
|
|
|
@app.route("/redirect-relative")
|
|
|
|
def redirect_relative():
|
|
|
|
response = Response(status=302)
|
|
|
|
response.headers["Location"] = "/redirected"
|
|
|
|
response.autocorrect_location_header = False
|
|
|
|
return response
|
|
|
|
|
|
|
|
|
2022-02-05 08:56:33 +03:00
|
|
|
@app.route("/redirected")
|
2020-08-27 10:07:46 +03:00
|
|
|
def redirected():
|
2022-10-09 17:30:07 +03:00
|
|
|
return "Redirected"
|