From 2a1a511712c3e5ecfc95e78679c52991c2eeb9de Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 11 Jun 2020 15:43:39 +0200 Subject: Fix celery import error when celery dependency is missing --- ishtar_common/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ishtar_common/utils.py') diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index aae2783c7..6183cdc49 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -88,11 +88,13 @@ def fake_task(*args): return fake +task = fake_task if settings.USE_BACKGROUND_TASK: - from celery import shared_task - task = shared_task -else: - task = fake_task + try: + from celery import shared_task + task = shared_task + except ImportError: + pass class BColors: -- cgit v1.2.3