[QUESTION] How to redirect to another page
See original GitHub issueHow can I redirect to another page/endpoint after, for instance, authenticating a user?
In flask, we can use ‘request’ function to redirect to a another page/endpoint, but I don’t see how to do it with FastAPI.
from flask import Flask,redirect
app = Flask(__name__)
@app.route('/')
def hello():
return redirect("http://www.example.com")
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (13 by maintainers)
Top Results From Across the Web
How do I redirect to another webpage? - javascript
One does not simply redirect using jQuery. jQuery is not necessary, and window.location.replace(...) will best simulate an HTTP redirect.
Read more >5 ways to redirect a web page using JavaScript and jQuery
Another way to redirect to a web page in jQuery is by using the replace() function of the window.location object. This method removes...
Read more >Redirect page to another form based on users answer - Jotform
Is it possible to direct a user to a particular form based on the initial question. For example, if the user selects yes...
Read more >Redirect quiz to another page - RevenueHunt
If you'd like to redirect customers to another page after the quiz, you can try one of the methods listed below.
Read more >Redirects and Google Search | Documentation
If you just want to send users to a different page temporarily, use a temporary redirect. This will also ensure that Google keeps...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @euri10 !
Before you commit the time to adding it in the docs, @marcosmmb, does @euri10’s example solve your use case?
Let me copy it inline here:
simple code tested and working, couldn’t while afk, the logs show clearly you’re redirected to /redirected once you hit /redirect
hope it helps