From 44eabfe8074f6e441f214fb73dc8aad2de607596 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 5 Jul 2016 15:43:17 +0200 Subject: [PATCH] django: get_client_class: use CLIENT setting This makes the management command (`manage.py opbeat test`) use any custom client. --- opbeat/contrib/django/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opbeat/contrib/django/models.py b/opbeat/contrib/django/models.py index 5a001dbf..2bdc2116 100644 --- a/opbeat/contrib/django/models.py +++ b/opbeat/contrib/django/models.py @@ -110,7 +110,10 @@ class ProxyClient(object): default_client_class = 'opbeat.contrib.django.DjangoClient' -def get_client_class(client_path=default_client_class): +def get_client_class(client_path=None): + if client_path is None: + config = getattr(django_settings, 'OPBEAT', {}) + client_path = config.get('CLIENT', default_client_class) module, class_name = client_path.rsplit('.', 1) return getattr(__import__(module, {}, {}, class_name), class_name)