Created
September 2, 2012 20:47
-
-
Save alexanderjulo/3604408 to your computer and use it in GitHub Desktop.
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
% python test.py | |
teardown request. | |
teardown app context. | |
% |
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 | |
app = Flask(__name__) | |
@app.route('/') | |
def test(): | |
return 'Yep.' | |
@app.after_request | |
def after_request(response): | |
print "after request." | |
return response | |
@app.teardown_request | |
def teardown_request(response): | |
print "teardown request." | |
return response | |
@app.teardown_appcontext | |
def teardown_appcontext(response): | |
print "teardown app context." | |
return response | |
with app.test_request_context('/'): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment