Skip to content
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

WIP_Add Django Debug Toolbar #2940

Draft
wants to merge 1 commit into
base: testing
Choose a base branch
from

Conversation

FroggyFlox
Copy link
Member

Initial commit adding Django Debug Toolbar #2939

  • Add django-debug-toolbar package to the optional dev dependency group
  • Add --dev flag to build.sh to run poetry install with that flag
  • Add DjDTB to settings.py
  • Add DjDTB urls

This pull request is created with the only purpose to illustrate what would need to be implemented to use Django Debug Toolbar.
Ideally, all changes to settings.py and urls.py would need to be scripted as well so that no manual configuration would be required.

To run this branch, first checkout, then build from source with the new --dev flag. For instance, I run the following:

cd /opt/rockstor
systemctl stop rockstor rockstor-pre rockstor-build rockstor-bootstrap postgresql && systemctl start postgresql && ./build.sh --dev && poetry run initrock && systemctl enable --now rockstor-bootstrap && poetry run debug-mode ON

Note that DEBUG must be True for the toolbar to show up.

Add django-debug-toolbar package to the optional `dev` dependency group
Add `--dev` flag to build.sh to run `poetry install` with that flag
Add DjDTB to settings.py
Add DjDTB urls
Comment on lines +482 to +487
DEBUG_TOOLBAR_CONFIG = {
# Update to the latest AJAX request
# Without this, we can only catch the initial request
# which is not helpful in most of our cases
"UPDATE_ON_FETCH": True
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
DEBUG_TOOLBAR_CONFIG = {
# Update to the latest AJAX request
# Without this, we can only catch the initial request
# which is not helpful in most of our cases
"UPDATE_ON_FETCH": True
}
DEBUG_TOOLBAR_CONFIG = {
# Update to the latest AJAX request
# Without this, we can only catch the initial request
# which is not helpful in most of our cases
"UPDATE_ON_FETCH": True
# If using htmx, to retain toolbar handle
# through page renders add this
"ROOT_TAG_EXTRA_ATTRS": "hx-preserve"
}

If the project is contemplating to use htmx (#2735 and #2821) then this would also be required (among other things of course to enable htmx overall), according to:
https://django-debug-toolbar.readthedocs.io/en/stable/tips.html#working-with-htmx-and-turbo

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.

2 participants