Created
September 27, 2013 15:41
-
-
Save davidfic/6730644 to your computer and use it in GitHub Desktop.
Basic Flask __init__.py file
This file contains 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 | |
from flask.ext.debugtoolbar import DebugToolbarExtension | |
app = Flask(__name__) | |
from app import views, models | |
app.jinja_env.globals['get_resource_as_string'] = get_resource_as_string | |
# def debug(): | |
# assert current_app.debug == False | |
# toolbar = DebugToolbarExtension(app) | |
def get_resource_as_string(name, charset='utf-8'): | |
with app.open_resource(name) as f: | |
return f.read().decode(charset) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment