Created
May 15, 2014 01:34
-
-
Save InFog/18583180a9efa8e03e56 to your computer and use it in GitHub Desktop.
HTTP codes for redirects in Flask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, redirect, url_for | |
app = Flask(__name__) | |
@app.route("/page_to_redirect") | |
def page_to_redirect(): | |
"""Using a 307 (TEMPORARY REDIRECT)""" | |
return redirect(url_for("destination")), 307 | |
@app.route("/destination") | |
def destination(): | |
return "hi" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment