summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-16 09:06:40 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-20 21:23:01 +0200
commit75d6c4ae6df93c4c4d8621aced3a180afa18a6cb (patch)
treea446318521173eadf0067e57a9b02c06ed9062d4 /django
parentd25710a625fbb6dbb047c159417f796102fd721a (diff)
Refs #31180 -- Removed default_app_config application configuration variable per deprecation timeline.
Diffstat (limited to 'django')
-rw-r--r--django/apps/config.py44
1 files changed, 4 insertions, 40 deletions
diff --git a/django/apps/config.py b/django/apps/config.py
index 7dfb4b4e15..671db98200 100644
--- a/django/apps/config.py
+++ b/django/apps/config.py
@@ -1,10 +1,8 @@
import inspect
import os
-import warnings
from importlib import import_module
from django.core.exceptions import ImproperlyConfigured
-from django.utils.deprecation import RemovedInDjango41Warning
from django.utils.functional import cached_property
from django.utils.module_loading import import_string, module_has_submodule
@@ -102,7 +100,6 @@ class AppConfig:
"""
# create() eventually returns app_config_class(app_name, app_module).
app_config_class = None
- app_config_name = None
app_name = None
app_module = None
@@ -134,7 +131,6 @@ class AppConfig:
]
if len(app_configs) == 1:
app_config_class = app_configs[0][1]
- app_config_name = '%s.%s' % (mod_path, app_configs[0][0])
else:
# Check if there's exactly one AppConfig subclass,
# among those that explicitly define default = True.
@@ -151,43 +147,11 @@ class AppConfig:
)
elif len(app_configs) == 1:
app_config_class = app_configs[0][1]
- app_config_name = '%s.%s' % (mod_path, app_configs[0][0])
- # If app_module specifies a default_app_config, follow the link.
- # default_app_config is deprecated, but still takes over the
- # automatic detection for backwards compatibility during the
- # deprecation period.
- try:
- new_entry = app_module.default_app_config
- except AttributeError:
- # Use the default app config class if we didn't find anything.
- if app_config_class is None:
- app_config_class = cls
- app_name = entry
- else:
- message = (
- '%r defines default_app_config = %r. ' % (entry, new_entry)
- )
- if new_entry == app_config_name:
- message += (
- 'Django now detects this configuration automatically. '
- 'You can remove default_app_config.'
- )
- else:
- message += (
- "However, Django's automatic detection %s. You should "
- "move the default config class to the apps submodule "
- "of your application and, if this module defines "
- "several config classes, mark the default one with "
- "default = True." % (
- "picked another configuration, %r" % app_config_name
- if app_config_name
- else "did not find this configuration"
- )
- )
- warnings.warn(message, RemovedInDjango41Warning, stacklevel=2)
- entry = new_entry
- app_config_class = None
+ # Use the default app config class if we didn't find anything.
+ if app_config_class is None:
+ app_config_class = cls
+ app_name = entry
# If import_string succeeds, entry is an app config class.
if app_config_class is None: