diff --git a/rhodecode/lib/middleware/appenlight.py b/rhodecode/lib/middleware/appenlight.py index 13a4efa6..f4dfdff1 100644 --- a/rhodecode/lib/middleware/appenlight.py +++ b/rhodecode/lib/middleware/appenlight.py @@ -21,10 +21,19 @@ """ middleware to handle appenlight publishing of errors """ +import logging -from appenlight_client import make_appenlight_middleware -from appenlight_client.exceptions import get_current_traceback -from appenlight_client.wsgi import AppenlightWSGIWrapper +log = logging.getLogger(__name__) + +appenlight_installed = False + +try: + from appenlight_client import make_appenlight_middleware + from appenlight_client.exceptions import get_current_traceback + from appenlight_client.wsgi import AppenlightWSGIWrapper + appenlight_installed = True +except ImportError: + log.info('Appenlight packages not present, skipping appenlight setup') def track_exception(environ): @@ -63,7 +72,7 @@ def wrap_in_appenlight_if_enabled(app, settings, appenlight_client=None): This is in use to support our setup of the vcs related middlewares. """ - if settings['appenlight']: + if appenlight_installed and settings['appenlight']: app = RemoteTracebackTracker(app) if not appenlight_client: app = make_appenlight_middleware(app, settings)