<分区> 分区>
任务.py:
from celery import Celery
app = Celery('tasks', broker='amqp://guest@localhost//')
@app.task
def add(x, y):
return x + y
调用.py:
from tasks import add
result = add.delay(1, 4)
result.ready()
celeryconfig.py:(在同一目录下)
BROKER_URL = 'amqp://guest@localhost//'
CELERY_RESULT_BACKEND = 'amqp://guest@localhost//'
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT=['json']
CELERY_TIMEZONE = 'Europe/Oslo'
CELERY_ENABLE_UTC = True
在 call.py 我有一个错误:
AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for'
我阅读了文档,我有结果后端,为什么它不起作用?如何解决?
谢谢!
