Skip to content

default_app_config in __init__.py deprecated since Django 3.2 #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tbrlpld opened this issue Nov 8, 2021 · 2 comments · Fixed by #160
Closed

default_app_config in __init__.py deprecated since Django 3.2 #157

tbrlpld opened this issue Nov 8, 2021 · 2 comments · Fixed by #160
Labels
bug Something isn't working django Related to Django templates capabilities duplicate This issue or pull request already exists

Comments

@tbrlpld
Copy link
Collaborator

tbrlpld commented Nov 8, 2021

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

@tbrlpld
Copy link
Collaborator Author

tbrlpld commented Nov 18, 2021

Noticing this is a duplicate of #153

@thibaudcolas
Copy link
Member

Indeed!

@thibaudcolas thibaudcolas added bug Something isn't working duplicate This issue or pull request already exists django Related to Django templates capabilities labels Dec 16, 2021
@nickmoreton nickmoreton linked a pull request Dec 21, 2021 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working django Related to Django templates capabilities duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants