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

Document how to toggle django-debug-toolbar with envvar #977

Merged
merged 4 commits into from
Jan 8, 2025

Conversation

hmpf
Copy link
Contributor

@hmpf hmpf commented Nov 27, 2024

No description provided.

@hmpf hmpf added the documentation Improvements or additions to documentation label Nov 27, 2024
@hmpf hmpf requested review from a team November 27, 2024 12:39
@hmpf hmpf self-assigned this Nov 27, 2024
@elfjes
Copy link
Collaborator

elfjes commented Nov 27, 2024

nice, perhaps we can even throw in an assert "debug_toolbar" not in INSTALLED_APPS in a production settings.py file

@codecov-commenter
Copy link

codecov-commenter commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.75%. Comparing base (5a6b8c1) to head (8248265).
Report is 64 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #977      +/-   ##
==========================================
- Coverage   81.93%   80.75%   -1.19%     
==========================================
  Files         132      123       -9     
  Lines        4861     4188     -673     
==========================================
- Hits         3983     3382     -601     
+ Misses        878      806      -72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hmpf hmpf force-pushed the toggle-django-debug-toolbar branch from e7914d5 to 139ed66 Compare December 4, 2024 06:53
Copy link

sonarqubecloud bot commented Dec 4, 2024

Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

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

This did not work out of the box, though.

I've never used Django Debug Toolbar at all before, and it seems it's not enough to add some environment variable to make it work in Argus.

I had to put at least these things into my settings file as well, to make Django Debug Toolbar appear:

DEBUG=True

INTERNAL_IPS = [
    "127.0.0.1",
]

DEBUG_TOOLBAR_CONFIG = {
    "ROOT_TAG_EXTRA_ATTRS": "hx-preserve"
}

If you have to manipulate your settings file to make it work anyway, why bother with the environment variable? Why not just have a how-to that shows a complete settings file example instead?

docs/development/howtos/toggle-django-debug-toolbar.rst Outdated Show resolved Hide resolved
docs/development/howtos/toggle-django-debug-toolbar.rst Outdated Show resolved Hide resolved
docs/development/howtos/toggle-django-debug-toolbar.rst Outdated Show resolved Hide resolved
@hmpf hmpf requested a review from lunkwill42 January 8, 2025 09:54
@hmpf
Copy link
Contributor Author

hmpf commented Jan 8, 2025

This did not work out of the box, though.

I've never used Django Debug Toolbar at all before, and it seems it's not enough to add some environment variable to make it work in Argus.

I had to put at least these things into my settings file as well, to make Django Debug Toolbar appear:

DEBUG=True

INTERNAL_IPS = [
    "127.0.0.1",
]

DEBUG_TOOLBAR_CONFIG = {
    "ROOT_TAG_EXTRA_ATTRS": "hx-preserve"
}

That INTERNAL_IPS isn't explicitly set the same for everyone is a problem, see #1113. We should probably document it as well.

DEBUG is preferably controlled by an environment variable, hard-coding it anywhere would prevent that.

It works for me without the DEBUG_TOOLBAR_CONFIG-bit but I can't see how adding it will hurt so I have updated the example accordingly.

@hmpf hmpf requested a review from lunkwill42 January 8, 2025 10:16
Copy link

sonarqubecloud bot commented Jan 8, 2025

@hmpf hmpf merged commit 06f518f into Uninett:master Jan 8, 2025
14 checks passed
@hmpf hmpf deleted the toggle-django-debug-toolbar branch January 8, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants