diff --git a/jupyterhub/alembic/env.py b/jupyterhub/alembic/env.py index 81eca8ee..15399b9f 100644 --- a/jupyterhub/alembic/env.py +++ b/jupyterhub/alembic/env.py @@ -12,9 +12,16 @@ config = context.config # Interpret the config file for Python logging. # This line sets up loggers basically. if 'jupyterhub' in sys.modules: + from traitlets.config import MultipleInstanceError from jupyterhub.app import JupyterHub + app = None if JupyterHub.initialized(): - app = JupyterHub.instance() + try: + app = JupyterHub.instance() + except MultipleInstanceError: + # could have been another Application + pass + if app is not None: alembic_logger = logging.getLogger('alembic') alembic_logger.propagate = True alembic_logger.parent = app.log