Vin
Vin

Reputation: 986

Python Huey throws huey.exceptions.HueyException: xxxxxx not found in TaskRegistry

I'm trying to integrate Huey with Django where I'm almost done with the initial setting of app and everything with redis. Now when I'm running the actual .py file I'm getting an exception huey.exceptions.HueyException: xxxxxxx not found in TaskRegistry. I have followed all the steps mentioned in here but still no luck so far. Can someone please help and throw some light on what I'm missing or if something is wrong. Thanks in advance.

Below is my code and app settings:

schedule_task.py

Task schedule code

settings.py

enter image description here

Command which I'm using to run the schedule_task.py

python manage.py shell < hueyTasks/schedule_task.py

Redis running on my local enter image description here

python manage.py run_huey command to run the consumer enter image description here

Upvotes: 3

Views: 1374

Answers (1)

Radu
Radu

Reputation: 8699

Your consumer isn't finding your tasks. Assuming that you've added 'huey.contrib.djhuey' to INSTALLED_APPS in settings.py as described in the docs, the likely issue is that you've named your task containing file something other than tasks.py, which is what Huey's Django integration relies on for auto-discovery:

To run the consumer, use the run_huey management command. This command will automatically import any modules in your INSTALLED_APPS named tasks.py. The consumer can be configured using both the django settings module and/or by specifying options from the command-line.

Alternatively, you can eschew the auto-discovery feature, but then you have to restructure your code a little bit. See docs for details. My recommendation is that you just rename your file tasks.py.

Upvotes: 2

Related Questions