Exemplo n.º 1
0
if os.getenv('FLASK_CONFIG'):
    app.config.from_envvar('FLASK_CONFIG')

if app.debug:
    logging.getLogger().setLevel(logging.DEBUG)

db = SQLAlchemy(app)

mail = Mail(app)

# static assets
assets = PythonLoader('app.assetconfig').load_environment()
bundles = PythonLoader('app.assetconfig').load_bundles()

for bundle_name, bundle in bundles.items():
    assets.register(bundle_name, bundle)


@app.context_processor
def debug_context():
    "Notifies templates that they're in debug mode"
    return dict(debug=app.debug)


@app.context_processor
def ga_context():
    "Notifies templates that they're in debug mode"
    return dict(google_analytics_id=app.config['GOOGLE_ANALYTICS_ID'])

Exemplo n.º 2
0
if os.getenv('FLASK_CONFIG'):
    app.config.from_envvar('FLASK_CONFIG')

if app.debug:
    logging.getLogger().setLevel(logging.DEBUG)

db = SQLAlchemy(app)

mail = Mail(app)

# static assets
assets = PythonLoader('app.assetconfig').load_environment()
bundles = PythonLoader('app.assetconfig').load_bundles()

for bundle_name, bundle in bundles.items():
    assets.register(bundle_name, bundle)


@app.context_processor
def debug_context():
    "Notifies templates that they're in debug mode"
    return dict(debug=app.debug)


@app.context_processor
def ga_context():
    "Notifies templates that they're in debug mode"
    return dict(google_analytics_id=app.config['GOOGLE_ANALYTICS_ID'])