About Solving Conflicts with Huey and Celery

Both background task managers, Huey and Celery, suggest placing the tasks in tasks.py files at your Django apps.

When using Huey, some third party libraries might be conflicting when they have functionalities for Celery. To solve that, you would need to disable auto-discovery of tasks functions and instead register your tasks for Huey manually by importing them in the app configs:

1
$ python manage.py run_huey --disable-autoload

myapp/apps.py

1
2
3
4
5
6
7
8
from django.apps import AppConfig

class MyAppConfig(AppConfig):
    name = "myapp"
    verbose_name = "My App"

    def ready(self):
        from . import tasks

Tips and Tricks Programming Dev Ops Django 4.x Django 3.2 Django 2.2 Huey Celery