Provide a mechanism for apps to define a default AppConfig
|Reported by:||Russell Keith-Magee||Owned by:||Aymeric Augustin|
|Cc:||app-loading, signals, checks||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The AppLoading refactor provides a mechanism for defining an AppConfig object. This AppConfig object provides hooks where you can define useful properties about the app itself. In particular, the
ready() method is potentially useful for handling admin autodiscovery, signal registrations, and system checks.
However, it's an opt-in mechanism. You need to explicitly name the appConfig object in your
INSTALLED_APPS for the AppConfig object to be used (e.g.,
django.contrib.auth.apps.AppConfig).he old approach of putting the top level module (e.g.,
django.contrib.auth) still works.
However, if you use the old approach, none of the AppConfig startup mechanisms are activated, which limits how much functionality we (at a framework level) can put into
AppConfig.ready() methods for contrib apps.
There should be a way for apps to specify a "default" AppConfig object, so that if the old-style
INSTALLED_APPS declaration is used, that AppConfig object is instantiated.
Change History (6)
comment:1 Changed 3 years ago by
|Cc:||app-loading signals checks added|
|Triage Stage:||Unreviewed → Accepted|
comment:2 Changed 3 years ago by
|Owner:||changed from nobody to Aymeric Augustin|
|Status:||new → assigned|