Django Celery tutorial not returning results

后端 未结 2 618
梦如初夏
梦如初夏 2021-01-02 03:24

UDATE3: found the issue. See the answer below.

UPDATE2: It seems I might have been dealing with an automatic naming and relative im

相关标签:
2条回答
  • 2021-01-02 04:03

    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.

    0 讨论(0)
  • 2021-01-02 04:24

    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

    0 讨论(0)
提交回复
热议问题