I have Django 2.1.7
I read Django documentation as well as, this How to use django AppConfig.ready() and this Overriding AppConfig.ready().
Now, the folder/file structure is like this,
my_app
__init__.py
urls.py
sub_app1
migrations
__init__.py
admin.py
apps.py
models.py
...
sub_app2
...
sub_app3
...
and all sub_app
s are registered into INSTALLED_APPS
of Django settings.py
file as my_app.sub_app1
for example. I noticed that when I try to override ready()
for sub_app1
w/in sub_app1.apps.py
, overriding has no effect.
When I flatten my structure above as
my_app
__init__.py
urls.py
apps.py
overriding of ready
works fine.
In other words, it seems that overriding of ready
of a sub app w/in sub app's apps.py
doesn't work.
Also, whether using default_app_config
w/in sub app's __init__.py
or my_app.sub_app1.apps.SubApp1Config
w/in settings.py INSTALLED_APPS
it gives error django.core.exceptions.ImproperlyConfigured: Cannot import 'sub_app1'. Check that 'my_app.sub_app1.apps.SubApp1Config.name' is correct.
Why is this happening?