Skip to content

INSTALLED_APPS duplicate-registration guard #151

Description

@whisper67265

Problem

settings_override.py appended to INSTALLED_APPS unconditionally. When the override module was sourced more than once in the same process (common with Django test runners, management commands that re-import --settings, or gunicorn preload+fork), the endpoint app config was registered multiple times. That could raise RuntimeError: Conflicting app_label on startup, or silently double-register AppConfig.ready() side effects such as duplicate URL hooks.

Acceptance Criteria

  • settings_override.py guards the INSTALLED_APPS append with an _ENDPOINT_APP_CONFIG not in _INSTALLED_APPS check
  • A unit test confirms that sourcing the override module twice in the same process does not duplicate entries in INSTALLED_APPS (list and tuple namespaces)
  • A unit test confirms that BoostEndpointConfig.ready() is not invoked twice after double exec() and django.setup()
  • Single-import startup behavior is unchanged (existing tests remain green)

Implementation Notes

  • Guard only the exact app config path the override appends (boost_weblate.endpoint.apps.BoostEndpointConfig); deduping WEBLATE_ADD_APPS + settings_override.py double-registration is out of scope.
  • Preserve existing list in-place += vs tuple rebind via globals() semantics for Docker exec() namespaces.
  • The ready() regression test runs in a subprocess because the main pytest session already calls django.setup() once.

References

  • src/boost_weblate/settings_override.py
  • tests/test_settings_override.py

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions