Skip to content

Instantly share code, notes, and snippets.

@sashadev-sky
Forked from brenj/blueprint.py
Created March 31, 2021 16:46
Show Gist options
  • Save sashadev-sky/e0a03aafec46e885edd56a231f823aa8 to your computer and use it in GitHub Desktop.
Save sashadev-sky/e0a03aafec46e885edd56a231f823aa8 to your computer and use it in GitHub Desktop.
Store application configuration in a Flask blueprint.
@blueprint.record_once
def record_params(state):
"""Store app.config in blueprint when blueprint is registered on app."""
app = state.app
blueprint.config = {key: value for key, value in app.config.iteritems()}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment