Django Celery tutorial not returning results

故事扮演 提交于 2019-11-30 12:14:01
sequoia

I found the solution to my problem from another stackoverflow post: Why does Celery work in Python shell, but not in my Django views? (import problem)

I had to add these lines to my settings file:

CELERY_RESULT_BACKEND = "amqp"
CELERY_IMPORTS = ("app.module.tasks", )

then in the task.py file I named the task as such:

@task(name="module.tasks.add")

The server and the client had to be informed of the task names. The celery and django-celery tutorials omit these lines in their tutorials.

if you run celery in debug mode is more easy understand the problem

python manage.py celeryd

What the celery logs says, celery is receiving the task ? If not probably there is a problem with broker (wrong queue ?)

Give us more detail, in this way we can help you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!