Problems with Celery Tasks from Django
Been fighting with an issue getting Celery tasks to work correctly from Django.
Was getting a lot of “Task of kind ‘blah’ is not registered, please make sure it’s imported.” errors in the celery log file. After quite a bit of faffing around I finally got it working by modifying my settings.py and also the main init.py file.
I added the following lines to my settings.py file:
CELERY_IMPORTS=('app.tasks', )
where ‘app’ is the name of the project itself.
Then, in the init.py file I added import lines for each of the tasks I need, e.g.
import SomeTask from tasks.sometask
It’s a bit messy, but it works well enough for the moment - I’ll make it better later!
Other relevant links:
Tweet |
|