﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35869	Add explicit warning when AppConfig.create() can't choose from multiple subclasses of AppConfig	schnee	schnee	"When I upgraded my Django project from 3.2 to 4.2, I found that the `ready` method in my custom AppConfig was never executed.

Example Code:


{{{
# apps/demo/__init__.py

default_app_config = ""apps.demo.CustomAppConfig""
}}}


{{{
# apps/demo/apps.py

from django.apps import AppConfig


class PlugableAppConfig(AppConfig):

    def ready(self):
        # do something...


class CustomAppConfig(PlugableAppConfig):
    name = ""apps.demo""
    
    def ready(self):
        super().ready()
        # do something...
}}}

After debugging, reading [https://docs.djangoproject.com/en/4.2/ref/applications/#configuring-applications documentation], and comparing version code, I determined that the reason was that Django 3.2 added support for [https://github.com/django/django/commit/3f2821af6bc48fa8e7970c1ce27bc54c3172545e automatic detection for AppConfig] to replace `default_app_config`, and support for the latter was [https://github.com/django/django/commit/75d6c4ae6df93c4c4d8621aced3a180afa18a6cb completely removed in version 4.1].

This is a great new feature, but if there are **multiple subclasses** of AppConfig in apps.py and none of them specify  `default` as `True` (legacy code), `AppConfig.create()` will default to using the Base AppConfig [https://github.com/django/django/blob/43287cbb87bc5e99a2fd384082a719d8b4d253c6/django/apps/config.py#L155 without any explicit warning].

This could lead to additional troubleshooting costs for developers. Therefore, I suggest that when `AppConfig.create()` cannot choose among multiple subclasses of AppConfig and defaults to using the Base AppConfig, a warning should be raised to alert developers."	Cleanup/optimization	closed	Core (Other)	5.0	Normal	wontfix	AppConfig	Aymeric Augustin	Accepted	1	0	0	0	0	0
