'disabledBackend'对象没有属性'_get_task_meta_for'

问题描述 投票:0回答:1

我收到错误“'DisabledBackend'对象没有属性'_get_task_meta_for'”../ 这是django settings.py

# celery settings
CELERY_RESULT_BACKEND = 'amqp'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'

而且,这是celery.py

from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from django.conf import settings

os.environ.setdefault('DJANGO_SETTINGS_MODULE', proj.settings)

app = Celery('proj', backend='amqp', broker='amqp://guest:guest@localhost:5672//')

app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)

我在ubuntu linux上安装了rabbitmq

$>sudo apt-get install rabbitmq-server

但是,这个代码在mac OSX中运行得很好!! 不适用于linux-ubuntu .. 我必须安装“elang”?? 我想我没有误认为'settings.py'和'celery.py'。 我从来不知道出了什么问题。

python linux django macos celery
1个回答
2
投票

我发现我的错误是什么:我必须在项目文件夹中将这些代码写入__init__.py

from __future__ import absolute_import, unicode_literals
from .celery import app as celery_app

__all__ = ['celery_app']
© www.soinside.com 2019 - 2024. All rights reserved.