appenlight: detect and disable appenlight if not installed
This commit is contained in:
parent
f7091556fd
commit
7aad90a506
1 changed files with 13 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue