Skip to content

Commit

Permalink
Allowing environments to import Blueprints
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Mar 3, 2017
1 parent 492df94 commit c4c25ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions superset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
app.config.from_object(CONFIG_MODULE)
conf = app.config

for bp in conf.get('BLUEPRINTS'):
try:
print("Registering blueprint: '{}'".format(bp.name))
app.register_blueprint(bp)
except Exception as e:
print("blueprint registration failed")
logging.exception(e)

if conf.get('SILENCE_FAB'):
logging.getLogger('flask_appbuilder').setLevel(logging.ERROR)

Expand Down
5 changes: 5 additions & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ class CeleryConfig(object):
# permission management
SILENCE_FAB = True


# Integrate external Blueprints to the app by passing them to your
# configuration. These blueprints will get integrated in the app
BLUEPRINTS = []

try:
if CONFIG_PATH_ENV_VAR in os.environ:
# Explicitly import config module that is not in pythonpath; useful
Expand Down

0 comments on commit c4c25ff

Please sign in to comment.