Skip to content

Debug Toolbar is missing #3 #19217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
peteeckel opened this issue Apr 16, 2025 · 4 comments · Fixed by #19289
Closed

Debug Toolbar is missing #3 #19217

peteeckel opened this issue Apr 16, 2025 · 4 comments · Fixed by #19289
Assignees
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Milestone

Comments

@peteeckel
Copy link
Contributor

peteeckel commented Apr 16, 2025

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.

@peteeckel peteeckel added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Apr 16, 2025
@arthanson arthanson added beta Concerns a bug/feature in a beta release status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Apr 17, 2025
@arthanson
Copy link
Collaborator

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.

@jeremystretch jeremystretch removed the beta Concerns a bug/feature in a beta release label Apr 21, 2025
@arthanson arthanson self-assigned this Apr 21, 2025
@arthanson arthanson removed the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label Apr 21, 2025
@jeremystretch jeremystretch added the status: accepted This issue has been accepted for implementation label Apr 22, 2025
@arthanson
Copy link
Collaborator

Actually looking at this thread django-commons/django-debug-toolbar#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 arthanson removed their assignment Apr 22, 2025
@arthanson arthanson added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Apr 22, 2025
@pheus
Copy link
Contributor

pheus commented 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.

@jeremystretch jeremystretch removed the status: accepted This issue has been accepted for implementation label Apr 23, 2025
@jeremystretch
Copy link
Member

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.

@arthanson arthanson self-assigned this Apr 23, 2025
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Apr 23, 2025
@jnovinger jnovinger modified the milestone: v4.2.9 Apr 23, 2025
@jnovinger jnovinger added this to the v4.2.9 milestone Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
5 participants