0

After following a tutorial, I have two views in my auth blueprint. I am confused over the different uses of redirect. The first view uses redirect(url_for()) but the second omits url_for. Why is this? Is it not enough to use just redirect('blueprint_name.route_name')?

return redirect(url_for('auth.unconfirmed'))
return redirect('main.index')
0

1 Answer 1

2

The second one doesn't work as intended.

redirect takes a URL. url_for generates URLs. The second example redirects to the URL main.index, which doesn't exist. (And even if it did exist, it's unlikely that's what you wanted.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.