django-background-task icon indicating copy to clipboard operation
django-background-task copied to clipboard

Tasks are not autodiscovered when using explicit AppConfig in INSTALLED_APPS

Open unformatt opened this issue 6 years ago • 1 comments

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])

unformatt avatar Feb 13 '19 16:02 unformatt

provisional solution here

ruben-mv avatar Feb 28 '19 11:02 ruben-mv