Skip to content

fix: register debug_toolbar in INSTALLED_APPS when DEBUG is on - #161

Merged
saqibmanan merged 1 commit into
mainfrom
fix/debug-toolbar-installed-apps
Sep 11, 2026
Merged

fix: register debug_toolbar in INSTALLED_APPS when DEBUG is on#161
saqibmanan merged 1 commit into
mainfrom
fix/debug-toolbar-installed-apps

Conversation

@saqibmanan

Copy link
Copy Markdown
Contributor

Why

Blocking today's attempt to trigger a real prod deploy — every "Build and push image" run failed at the sanity-check step (`manage.py check` with DEBUG defaulting True):

```
RuntimeError: Model class debug_toolbar.models.HistoryEntry doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
```

`MIDDLEWARE` conditionally adds debug_toolbar's middleware when `DEBUG` is True, but `INSTALLED_APPS` never registered the app itself. Checked git history — this pairing existed before (`if DEBUG: INSTALLED_APPS += ["debug_toolbar"]`) and the `INSTALLED_APPS` half got dropped somewhere along this repo's messy merge/revert history (see #153).

Fix

Register the app alongside the middleware, same conditional.

Test plan

  • `py_compile`
  • CI green
  • Companion PR to `dev`
  • Confirm the next "Build and push image" run passes its sanity-check step

MIDDLEWARE conditionally added debug_toolbar's middleware when DEBUG is
True, but INSTALLED_APPS never registered the app itself -- git history
shows this pairing existed before and the INSTALLED_APPS half got dropped
somewhere along this repo's messy merge/revert history.

Broke every build since (confirmed via 3 failed CI runs today, all at the
same step): the sanity-check step's `manage.py check` runs with DEBUG
defaulting to True (no DEBUG env var set), and any request/check path that
touches debug_toolbar's models crashes with "Model class
debug_toolbar.models.HistoryEntry doesn't declare an explicit app_label
and isn't in an application in INSTALLED_APPS" -- the middleware imports
the app's models without the app being registered.
@saqibmanan
saqibmanan merged commit 263ef33 into main Sep 11, 2026
6 checks passed
saqibmanan added a commit that referenced this pull request Sep 11, 2026
…-apps-dev

fix: register debug_toolbar in INSTALLED_APPS (dev companion to #161)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant