Debug Toolbar is missing #3 #11045

Closed
opened 2025-12-29 21:39:34 +01:00 by adam · 4 comments
Owner

Originally created by @peteeckel on GitHub (Apr 16, 2025).

Originally assigned to: @arthanson on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.3-beta1

Python Version

3.11

Steps to Reproduce

  1. Install NetBox, setting DEBUG=False in the configuration file
  2. After collectstatic has been executed, change this to DEBUG=True and restart NetBox
  3. Open the NetBox GUI in the browser

Expected Behavior

The Django debug menu is available.

Observed Behavior

It is not.

If collectstatic is executed manually after setting DEBUG=False, 494 static files are copies. If DEBUG is set to True, 501 are copied.

The files that are missing are:

> netbox/static/debug_toolbar/css/print.css
> netbox/static/debug_toolbar/css/toolbar.css
> netbox/static/debug_toolbar/js/history.js
> netbox/static/debug_toolbar/js/redirect.js
> netbox/static/debug_toolbar/js/timer.js
> netbox/static/debug_toolbar/js/toolbar.js
> netbox/static/debug_toolbar/js/utils.js

Which explains the problem neatly.

Originally created by @peteeckel on GitHub (Apr 16, 2025). Originally assigned to: @arthanson on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.3-beta1 ### Python Version 3.11 ### Steps to Reproduce 1. Install NetBox, setting `DEBUG=False` in the configuration file 2. After `collectstatic` has been executed, change this to `DEBUG=True` and restart NetBox 3. Open the NetBox GUI in the browser ### Expected Behavior The Django debug menu is available. ### Observed Behavior It is not. If `collectstatic` is executed manually after setting `DEBUG=False`, 494 static files are copies. If `DEBUG` is set to `True`, 501 are copied. The files that are missing are: ``` > netbox/static/debug_toolbar/css/print.css > netbox/static/debug_toolbar/css/toolbar.css > netbox/static/debug_toolbar/js/history.js > netbox/static/debug_toolbar/js/redirect.js > netbox/static/debug_toolbar/js/timer.js > netbox/static/debug_toolbar/js/toolbar.js > netbox/static/debug_toolbar/js/utils.js ``` Which explains the problem neatly.
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:39:34 +01:00
adam closed this issue 2025-12-29 21:39:34 +01:00
Author
Owner

@arthanson commented on GitHub (Apr 17, 2025):

This is actually an issue before 4.3, tied to issue #16454. This is fixed in newer versions of Debug Toolbar so could re-include this.

@arthanson commented on GitHub (Apr 17, 2025): This is actually an issue before 4.3, tied to issue [#16454](https://github.com/netbox-community/netbox/issues/16454). This is fixed in newer versions of Debug Toolbar so could re-include this.
Author
Owner

@arthanson commented on GitHub (Apr 22, 2025):

Actually looking at this thread https://github.com/django-commons/django-debug-toolbar/issues/1435 - debug toolbar can have performance and/or security issues if it is installed in middleware on production if DEBUG=False. Installing it but not having the middleware active will cause a system warning. So I'm not sure we want to go down this route.

@arthanson commented on GitHub (Apr 22, 2025): Actually looking at this thread https://github.com/django-commons/django-debug-toolbar/issues/1435 - debug toolbar can have performance and/or security issues if it is installed in middleware on production if DEBUG=False. Installing it but not having the middleware active will cause a system warning. So I'm not sure we want to go down this route.
Author
Owner

@pheus commented on GitHub (Apr 23, 2025):

Thanks for the clarification!

I agree that we should avoid adding the debug toolbar middleware in production environments, given the potential performance and security concerns.

That said, since toggling the DEBUG setting affects which static files are collected, would it make sense to add a note to the development documentation suggesting that developers re-run collectstatic after changing the DEBUG setting? This might help prevent confusion when enabling the debug toolbar during development.

@pheus commented on GitHub (Apr 23, 2025): Thanks for the clarification! I agree that we should avoid adding the debug toolbar middleware in production environments, given the potential performance and security concerns. That said, since toggling the `DEBUG` setting affects which static files are collected, would it make sense to add a note to the development documentation suggesting that developers re-run `collectstatic` after changing the `DEBUG` setting? This might help prevent confusion when enabling the debug toolbar during development.
Author
Owner

@jeremystretch commented on GitHub (Apr 23, 2025):

We could retain the debug toolbar in INSTALLED_APPS specifically for the collectstatic management command:

if not DEBUG and 'collectstatic' not in sys.argv:
    INSTALLED_APPS.remove('debug_toolbar')

This would ensure that the static assets get copied over every time regardless of the DEBUG setting without interfering with production use.

@jeremystretch commented on GitHub (Apr 23, 2025): We could retain the debug toolbar in `INSTALLED_APPS` specifically for the `collectstatic` management command: ```python if not DEBUG and 'collectstatic' not in sys.argv: INSTALLED_APPS.remove('debug_toolbar') ``` This would ensure that the static assets get copied over every time regardless of the `DEBUG` setting without interfering with production use.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11045