Last active
April 27, 2017 17:23
-
-
Save talwai/cb534452c0520ae8a40742611fddfcab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b547ad0a498bdba1c7ab357301cde806b310373e Mon Sep 17 00:00:00 2001 | |
From: talwai <[email protected]> | |
Date: Thu, 27 Apr 2017 12:10:23 -0400 | |
Subject: [PATCH] django: handle tuple INSTALLED_APPS | |
--- | |
ddtrace/contrib/django/patch.py | 6 +++++- | |
1 file changed, 5 insertions(+), 1 deletion(-) | |
diff --git a/ddtrace/contrib/django/patch.py b/ddtrace/contrib/django/patch.py | |
index 93319eb..820b110 100644 | |
--- a/ddtrace/contrib/django/patch.py | |
+++ b/ddtrace/contrib/django/patch.py | |
@@ -16,7 +16,11 @@ def traced_setup(wrapped, instance, args, kwargs): | |
from django.conf import settings | |
if 'ddtrace.contrib.django' not in settings.INSTALLED_APPS: | |
- settings.INSTALLED_APPS.append('ddtrace.contrib.django') | |
+ if isinstance(settings.INSTALLED_APPS, tuple): | |
+ # INSTALLED_APPS is a tuple < 1.9 | |
+ settings.INSTALLED_APPS = settings.INSTALLED_APPS + ('ddtrace.contrib.django', ) | |
+ else: | |
+ settings.INSTALLED_APPS.append('ddtrace.contrib.django') | |
if hasattr(settings, 'MIDDLEWARE_CLASSES'): | |
if 'ddtrace.contrib.django.TraceMiddleware' not in settings.MIDDLEWARE_CLASSES: | |
-- | |
2.3.5 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment