django-background-task
django-background-task copied to clipboard
Tasks are not autodiscovered when using explicit AppConfig in INSTALLED_APPS
In my INSTALLED_APPS
, my_app is not specified as simply as my_app
but rather as my_app.apps.MyAppConfig
. ~My tasks are located at my_app.tasks
but autodiscover()
looks for them at my_app.apps.MyAppConfig.tasks
because of how it iterates over INSTALLED_APPS
.~
autodiscover
tries to import_module('my_app.apps.MyAppConfig')
and fails because MyAppConfig is not a module. I don't know enough about AppConfigs or INSTALLED_APPS
to know if it's a reasonable fix to assume the first part of the path is always an app e.g. import_module(app.split('.')[0])
provisional solution here