Python 3.x, Celery 4.x...
I have a class-based task.
myproj/celery.py
from celery import Celery
# django settings stuff...
app
You can find full description here, but for me it was enough to add
from myapp.celery import app
app.tasks.register(MyTaskTask())
With celery==4.2.1 I had to use the return value of Celery.register_task() as the task instance to call delay() on:
# my_app/tasks.py
import celery
from my_app.celery import app
class MyTask(celery.Task):
def run(self):
[...]
MyTask = app.register_task(MyTask())
Then to use it:
# my_app/app.py
from my_app.tasks import MyTask
[...]
MyTask.delay()
The solution was described in a Github issue and is documented here.
Hth, dtk