Why does Celery work in Python shell, but not in my Django views? (import problem)

后端 未结 3 2103
渐次进展
渐次进展 2020-12-29 08:47

I installed Celery (latest stable version.) I have a directory called /home/myuser/fable/jobs. Inside this directory, I have a file called tasks.py:

         


        
3条回答
  •  北海茫月
    2020-12-29 09:08

    I believe your tasks.py file needs to be in a django app (that's registered in settings.py) in order to be imported. Alternatively, you might try importing the tasks from an __init__.py file in your main project or one of the apps.

    Also try starting celeryd from manage.py:

    $ python manage.py celeryd -E -B -lDEBUG
    

    (-E and -B may or may not be necessary, but that's what I use).

提交回复
热议问题