Skip to content

Commit aa1bc4c

Browse files
authored
Django: If no app configured, pass (#203)
1 parent df2391f commit aa1bc4c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

instana/instrumentation/django/middleware.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,13 @@ def load_middleware_wrapper(wrapped, instance, args, kwargs):
130130
# If we are instrumenting via AutoTrace (in an already running process), then the
131131
# WSGI middleware has to be live reloaded.
132132
from django.core.servers.basehttp import get_internal_wsgi_application
133-
wsgiapp = get_internal_wsgi_application()
134-
wsgiapp.load_middleware()
133+
from django.core.exceptions import ImproperlyConfigured
134+
135+
try:
136+
wsgiapp = get_internal_wsgi_application()
137+
wsgiapp.load_middleware()
138+
except ImproperlyConfigured:
139+
pass
135140

136141
except Exception:
137142
logger.debug("django.middleware:", exc_info=True)

0 commit comments

Comments
 (0)