Flask redirect not working at all on repl.it

Viewed 469

On repl.it, running flask works fine with something like

@app.route("/home")
def home():
  return render_template("home.html")

As the home template is rendered in the inspector Home template is rendered

However, running

@app.route("/")
def base_route():
  return redirect(url_for("home"))

@app.route("/home")
def home():
  return render_template("home.html")

Fails to render the page. No errors/exceptions are thrown.

enter image description here

Is this an issue with repl, or is the code just wrong?

1 Answers

The problem is on replit inspector side.

If you try with curl, you will see the redirect happens to url '/home'.

Also, in the upper right button of the inspector there is button that let you open your website/web app in a separate tab or window. There, from a regular browser window, the redirect will work. Or make index/root render template and redirect \home page to index\root, the problem seems to be specific to the root url.

I think you can discuss it in replit talk, it looks like a bug to me.

Related