flask for some urls redirect to another page code example
Example 1: how to redirect in flask to the same page
return redirect(request.referrer)
Example 2: how to redirect to another route in flask
from flask import Flask, render_templates
app = Flask(__name__)
@app.route("/")
def index:
return render_template("index.html")
@app.route("/home")
def home:
return redirect("/", code=302)
app.run()