lilspikey / django-background-task

A database-backed work queue for Django
BSD 3-Clause "New" or "Revised" License
107 stars 200 forks source link

Tasks are not autodiscovered when using explicit AppConfig in INSTALLED_APPS #26

Open unformatt opened 5 years ago

unformatt commented 5 years ago

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

ruben-mv commented 5 years ago

provisional solution here