#25356: startapp template mustn't encourage using default_app_config
-------------------------------------+-------------------------------------
Reporter: aaugustin | Owner: nobody
Type: Bug | Status: new
Component: Core | Version: master
(Management commands) |
Severity: Release | Keywords:
blocker |
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I just noticed that `startapp` now generates an `apps.py`. This isn't
unreasonable. However it also sets `default_app_config` in `__init__.py`.
I have strong doubts about this.
`default_app_config` is an ugly API that I included reluctantly for one
targeted use-case: allowing pre-existing pluggable apps to take advantage
of app config functionality in a backwards-compatible fashion, that is,
without requiring projets to upgrade their `INSTALLED_APPS` settings. The
first use of this feature was in `django.contrib.admin` in order to get
rid of `admin.autodiscover()` in `urls.py`.
Relying implicitly on a default app config if one exists is clearly a bad
practice. The good practice is to specifiy explicitly the full path to the
`AppConfig` class in `INSTALLED_APPS`.
I recommend to:
- remove this line from `app_template/__init__.py`
- promote explicit configuration of app configs in `INSTALLED_APPS`
- clarify the docs of `default_app_config` with the information I
described above
--
Ticket URL: <https://code.djangoproject.com/ticket/25356>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.a3da0c86e4400b9d011168167360776d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.