Skip to content

Instantly share code, notes, and snippets.

Created November 17, 2011 07:37
Show Gist options
  • Save anonymous/1372608 to your computer and use it in GitHub Desktop.
Save anonymous/1372608 to your computer and use it in GitHub Desktop.
Double meta refresh for flask
<html>
<head>
<meta name="robots" content="noindex" />
<meta http-equiv="refresh" content="0; url={{ url }}" />
</head>
</html>
# This would most likely be SQLAlchemy table or something
urls = { '1': 'http://siteA.com', '2': 'http://siteB.com' }
@bp.route("/redirect/<int:url_id>/"):
def redirect(url_id):
url = url_for('meta', url_id=url_id)
return render_template("meta.html", url=url)
@bp.route("/meta/<int:url_id>/")
def meta(url_id):
url = URLS[url_id]
return render_template("meta.html", url=url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment