Skip to content

default_app_config in __init__.py deprecated since Django 3.2 #157

Closed
@tbrlpld

Description

@tbrlpld

Is your proposal related to a problem?

Since Django 3.2 it is not necessary anymore to declare a default_app_config is only a single app config is present in the apps.py.

With that declaration, Django throws deprecation warnings like so:

/venv/lib/python3.8/site-packages/django/apps/registry.py:91: RemovedInDjango41Warning: 'pattern_library' defines default_app_config = 'pattern_library.apps.PatternLibraryAppConfig'. Django now detects this configuration automatically. You can remove default_app_config.

Describe the solution you'd like

Only define default_app_config for Django versions before 3.2.

# __init__.py
import django 

if django.VERSION < (3, 2):
    default_app_config = 'pattern_library.apps.PatternLibraryAppConfig'

See also
https://docs.djangoproject.com/en/3.2/releases/3.2/#automatic-appconfig-discovery

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdjangoRelated to Django templates capabilitiesduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions