diff --git a/{{ cookiecutter.name }}/src/.django-app-template/apps.py-tpl b/{{ cookiecutter.name }}/src/.django-app-template/apps.py-tpl index 865202f2..cb268f45 100644 --- a/{{ cookiecutter.name }}/src/.django-app-template/apps.py-tpl +++ b/{{ cookiecutter.name }}/src/.django-app-template/apps.py-tpl @@ -2,4 +2,5 @@ from app.base_config import AppConfig class {{ camel_case_app_name }}Config(AppConfig): + default = True name = "{{ app_name }}" diff --git a/{{ cookiecutter.name }}/src/app/apps.py b/{{ cookiecutter.name }}/src/app/apps.py index efd3843c..b591ade0 100644 --- a/{{ cookiecutter.name }}/src/app/apps.py +++ b/{{ cookiecutter.name }}/src/app/apps.py @@ -1,5 +1,9 @@ -from django.apps import AppConfig as DjangoAppConfig +from django.utils.translation import gettext_lazy as _ +from app.base_config import AppConfig as BaseAppConfig -class AppConfig(DjangoAppConfig): + +class AppConfig(BaseAppConfig): + default = True name = "app" + verbose_name = _("Application") diff --git a/{{ cookiecutter.name }}/src/app/base_config.py b/{{ cookiecutter.name }}/src/app/base_config.py index 84f14dba..3a8df185 100644 --- a/{{ cookiecutter.name }}/src/app/base_config.py +++ b/{{ cookiecutter.name }}/src/app/base_config.py @@ -5,16 +5,20 @@ class AppConfig(BaseAppConfig): - """Default App configuration template. Import app.signals.handers. + """Default App configuration template. Imports app.signals.handlers. - We do not recomend you to use django signals at all. + We do not recommend you to use django signals at all. Check out https://lincolnloop.com/blog/django-anti-patterns-signals/ if you know nothing about that. - Allthough, if you wish to use signals, place handlers to the `signals/handlers.py`: - your code be automatically imported and used. + Although, if you wish to use signals, place handlers to the `signals/handlers.py`: + your code will be automatically imported and used. """ + # Django's `apps.py` scan sees two configs — yours and this one, pulled in by your import. + # `False` here, `True` in your subclass: otherwise Django silently takes a plain AppConfig. + default = False + def ready(self) -> None: """Import a module with handlers if it exists to avoid boilerplate code.""" with contextlib.suppress(ModuleNotFoundError): diff --git a/{{ cookiecutter.name }}/src/app/conf/i18n.py b/{{ cookiecutter.name }}/src/app/conf/i18n.py index 040ac52f..951e3de3 100644 --- a/{{ cookiecutter.name }}/src/app/conf/i18n.py +++ b/{{ cookiecutter.name }}/src/app/conf/i18n.py @@ -6,5 +6,3 @@ LOCALE_PATHS = [ SRC_DIR / ".locale", ] - -USE_i18N = True diff --git a/{{ cookiecutter.name }}/src/users/apps.py b/{{ cookiecutter.name }}/src/users/apps.py new file mode 100644 index 00000000..a62a6eb0 --- /dev/null +++ b/{{ cookiecutter.name }}/src/users/apps.py @@ -0,0 +1,9 @@ +from django.utils.translation import gettext_lazy as _ + +from app.base_config import AppConfig as BaseAppConfig + + +class AppConfig(BaseAppConfig): + default = True + name = "users" + verbose_name = _("Users")