Skip to content

Instantly share code, notes, and snippets.

@InFog
Created May 15, 2014 01:34
Show Gist options
  • Save InFog/18583180a9efa8e03e56 to your computer and use it in GitHub Desktop.
Save InFog/18583180a9efa8e03e56 to your computer and use it in GitHub Desktop.
HTTP codes for redirects in Flask
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