Celery autodiscover_tasks not working for all Django 1.7 apps

This is discussed in a number of Celery issues, such as #2596 and #2597.

If you are using Celery 3.x, the fix is to use:

from django.apps import apps
app.autodiscover_tasks(lambda: [n.name for n in apps.get_app_configs()])

As mentioned in #3341, if you are using Celery 4.x (soon to be released) you can use:

app.autodiscover_tasks()

I just had this problem because of a misconfigured virtual environment.

If an installed app has a dependency missing from the virtual environment in which you're running celery, then the installed app's tasks will not be auto discovered. This hit me as I was moving from running my web server and celery on the same machine to a distributed solution. A bad build resulted in different environment files on different nodes.

I added the dependencies that were missing then restarted the celery service.