Sfoglia il codice sorgente

Catch AttributeError on missing "tasks" module

Ask Solem 15 anni fa
parent
commit
2b72d6346f
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      celery/loaders/djangoapp.py

+ 4 - 1
celery/loaders/djangoapp.py

@@ -85,4 +85,7 @@ def find_related_module(app, related_name):
 
     module = importlib.import_module("%s.%s" % (app, related_name))
 
-    return getattr(module, related_name)
+    try:
+        return getattr(module, related_name)
+    except AttributeError:
+        return