瀏覽代碼

find_app: Handle import error from proj.celery:

Ask Solem 12 年之前
父節點
當前提交
ee682dd35b
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      celery/bin/base.py

+ 5 - 2
celery/bin/base.py

@@ -440,8 +440,11 @@ class Command(object):
                 return sym.celery
             except AttributeError:
                 if getattr(sym, '__path__', None):
-                    return self.find_app('{0}.celery:'.format(
-                                         app.replace(':', '')))
+                    try:
+                        return self.find_app('{0}.celery:'.format(
+                                             app.replace(':', '')))
+                    except ImportError:
+                        pass
                 from celery.app.base import Celery
                 for suspect in values(vars(sym)):
                     if isinstance(suspect, Celery):