Celery Error: Did you remember to import the module containing this task?

report errors:

Did you remember to import the module containing this task?
Or maybe you're using relative imports?

Please see
http://docs.celeryq.org/en/latest/internals/protocol.html
for more information.

The full contents of the message body was:
b'[[], {}, {"callbacks": null, "errbacks": null, "chain": null, "chord": null}]' (77b)
Traceback (most recent call last):
  File "d:\venv\lib\site-packages\celery\worker\consumer\consumer.py", line 555, in on_task_received
    strategy = strategies[type_]
KeyError: 'terminal.tasks.add_order_and_other'

The reason for this error is that the task has not been found. There are two ways for celery to find the task
1. First of all, Django + celery is used here, not djcelery. Import all tasks in tasks.py in the view view function under settings
from. Task import add_ data, add_ course, add_ order_ and_ Other
(only import is OK) (this method is not recommended, because it’s a bit of heresy, hahaha)
2. Add app.autodiscover in cell.py_ Tasks ([‘terminal. Tasks’]), terminal. Tasks is the location of the task file.

Tips: if you close the corresponding window after starting the cell, the cell timer task will stop
when you start the cell by using the cell multi start W1 – a project name – B, the window timer task will not stop either. At the same time, you do not need to start the beat by using this command.

Read More: