Skip to content

Fix app config base class being silently ignored - #852

Merged
nkiryanov merged 1 commit into
masterfrom
fix/app-config-silently-ignored
Jul 25, 2026
Merged

Fix app config base class being silently ignored#852
nkiryanov merged 1 commit into
masterfrom
fix/app-config-silently-ignored

Conversation

@nkiryanov

Copy link
Copy Markdown
Contributor

App configs from manage.py startapp have never been applied.
The generated subclass imports the base — Django finds two AppConfigs in apps.py, neither marked default, and quietly falls back to a plain one.
default = False on the base and default = True in the template fix it.

App configs from `manage.py startapp` have never been applied.
The generated subclass imports the base — Django finds two AppConfigs in `apps.py`, neither marked default, and quietly falls back to a plain one.
`default = False` on the base and `default = True` in the template fix it.
@nkiryanov
nkiryanov force-pushed the fix/app-config-silently-ignored branch 2 times, most recently from 876dcc8 to 665bff7 Compare July 25, 2026 15:18

# 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот это default нужен чтоб брался правильно сконфигурированный класс из my_app/app.py

Иначе при регистрации приложения в installed_app попадал класс AppConfig — в своё время несколько часов пришлось дебажить почему переводы приложений в админку не доходят.

@nkiryanov

Copy link
Copy Markdown
Contributor Author

@kazqvaizer, @f213 может вообще удалим переопределенный class AppConfig(BaseAppConfig)?
Насколько часто с сигналами что-то делаем, что в бойлерплейте держать?

@nkiryanov
nkiryanov merged commit bbd5bd4 into master Jul 25, 2026
3 checks passed
@nkiryanov
nkiryanov deleted the fix/app-config-silently-ignored branch July 25, 2026 15:26
@nkiryanov
nkiryanov requested review from f213 and kazqvaizer July 25, 2026 15:26
SRC_DIR / ".locale",
]

USE_i18N = True

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это:

  • не нужно, т.к. теперь True всегда по дефолту
  • никогда не работало, т.к. ключ с ошибкой (должен быть USE_I18N iI)

@kazqvaizer

Copy link
Copy Markdown
Contributor

может вообще удалим? Насколько часто с сигналами что-то делаем, что в бойлерплейте держать?

Не думаю, это выглядит скорее как манифест - если удалим, то наши же LLM могут нахулиганить нам сигналов.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants