浏览代码

Fixes required for Flask-Celery to work

Ask Solem 14 年之前
父节点
当前提交
c09e686897
共有 3 个文件被更改,包括 4 次插入1 次删除
  1. 1 0
      celery/app/base.py
  2. 2 1
      celery/bin/base.py
  3. 1 0
      celery/task/base.py

+ 1 - 0
celery/app/base.py

@@ -208,6 +208,7 @@ class BaseApp(object):
         return c
         return c
 
 
     def post_config_merge(self, c):
     def post_config_merge(self, c):
+        # XXX This should be done by whoever requires these settings.
         """Prepare configuration after it has been merged with the
         """Prepare configuration after it has been merged with the
         defaults."""
         defaults."""
         if not c.get("CELERY_QUEUES"):
         if not c.get("CELERY_QUEUES"):

+ 2 - 1
celery/bin/base.py

@@ -69,7 +69,8 @@ class Command(object):
     def setup_app_from_commandline(self, argv):
     def setup_app_from_commandline(self, argv):
         preload_options = self.parse_preload_options(argv)
         preload_options = self.parse_preload_options(argv)
         app = (preload_options.pop("app", None) or
         app = (preload_options.pop("app", None) or
-               os.environ.get("CELERY_APP"))
+               os.environ.get("CELERY_APP") or
+               self.app)
         loader = (preload_options.pop("loader", None) or
         loader = (preload_options.pop("loader", None) or
                   os.environ.get("CELERY_LOADER") or
                   os.environ.get("CELERY_LOADER") or
                   "default")
                   "default")

+ 1 - 0
celery/task/base.py

@@ -729,6 +729,7 @@ def create_task_cls(app, **kwargs):
     apps = [app]
     apps = [app]
 
 
     class Task(BaseTask):
     class Task(BaseTask):
+        abstract = True
         app = apps[0]
         app = apps[0]
         backend = app.backend
         backend = app.backend
         exchange_type = app.conf.CELERY_DEFAULT_EXCHANGE_TYPE
         exchange_type = app.conf.CELERY_DEFAULT_EXCHANGE_TYPE