how to redirect in flask to the same page

return redirect(request.referrer)

Here is what the above code is Doing:
1. We’re using the @login_required decorator to make sure that only logged in users can access the view.
2. We’re using the request.referrer to get the previous page the user was on.
3. We’re using the redirect function to redirect the user to the previous page.