Skip to content

Instantly share code, notes, and snippets.

@methane
Created January 12, 2012 10:46
Show Gist options
  • Select an option

  • Save methane/1599820 to your computer and use it in GitHub Desktop.

Select an option

Save methane/1599820 to your computer and use it in GitHub Desktop.
Flask request context
import flask
app = flask.Flask(__name__)
@app.before_request
def setup():
print "setup"
@app.teardown_request
def teardown(exc):
print "teardown"
with app.test_request_context():
print "---"
#Output:
# ---
# teardown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment