torchbox / django-pattern-library

UI pattern libraries for Django templates
https://torchbox.github.io/django-pattern-library/
BSD 3-Clause "New" or "Revised" License
368 stars 46 forks source link

`default_app_config` in `__init__.py` deprecated since Django 3.2 #157

Closed tbrlpld closed 2 years ago

tbrlpld commented 2 years ago

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 commented 2 years ago

Noticing this is a duplicate of #153

thibaudcolas commented 2 years ago

Indeed!