Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#32382 closed Cleanup/optimization (wontfix)

Django 3.2 app config search prevents single-file apps

Reported by: Adam Johnson Owned by: nobody
Component: Core (Other) Version: 3.2
Severity: Normal Keywords:
Cc: Aymeric Augustin Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adam Johnson)

My third party package django-read-only is implemented as a single file (pre-3.1-support source). With Django <3.2's default_app_config, it could point to its app config within the same module by defining default_app_config.

Now the AppConfig logic *requires* an apps submodule, which means apps cannot be single-file modules but have to be packages.

To work around this in django-read-only I made it into package, left all the logic in its __init__.py, and added a "dummy" apps.py that has only the line from django_read_only import DjangoReadOnlyAppConfig (moving the app config would complicate its implementation). (commit )

Could we make the apps logic not search for an 'apps' submodule in the case of non-package modules, and instead check in the base module?

Change History (4)

comment:1 by Adam Johnson, 4 years ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 4 years ago

Resolution: needsinfo
Status: newclosed

django_read_only==1.2.0 works fine as a single file (without default_app_config) when you will use django_read_only.DjangoReadOnlyAppConfig in the INSTALLED_APPS, instead of django_read_only. It's niche, so I'm not sure if supporting default app configs in the base module is worth additional complexity and side-effects (such as e.g. clashes), but we could evaluate a patch.

comment:3 by Adam Johnson, 4 years ago

Yes that's true. It's probably not worth complicating things.

comment:4 by Mariusz Felisiak, 4 years ago

Resolution: needsinfowontfix
Note: See TracTickets for help on using tickets.
Back to Top