I want to load a number of classes I've put in a module that's not part of the settings.INSTALLED_APPS
list. (I want my customers to be able to write their own subclasses which can be dynamically loaded or reloaded.) I have a function called load_classes()
to do so. The question is where to call it when my project initially starts.
My first attempt at this was placing load_classes
in the ready()
function of AppConfig
as per this question, but that apparently only is invoked after the particular app with the AppConfig
is done loading, not all of them. Since these class definitions import models and functions from other apps in the project, I ended up with this error:
File "/Users/dylan/.local/share/virtualenvs/pipeproj-oDyHbVBN/lib/python3.8/site-packages/django/apps/registry.py", line 135, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
Where can I place my importing code, so it's triggered once all of the Django apps have been loaded?