Skip to content

Commit

Permalink
Showing full template hierarchy for debug toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
mrchrisadams committed May 28, 2024
1 parent afc8c25 commit b164559
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions greenweb/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@

INSTALLED_APPS.insert(0, "whitenoise.runserver_nostatic") # noqa

# this snippet allows us to see the hierarchy of templates used to render a page
# without it DEBUG_TOOLBAR runs out of "cache slots", and shows a message saying:

# "Data for this panel isn't available anymore. Please reload the page and retry."

# For more, see:
# https://timonweb.com/django/fixing-the-data-for-this-panel-isnt-available-anymore-error-in-django-debug-toolbar/
if DEBUG:
hide_toolbar_patterns = ["/media/", "/static/"]

DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": lambda request: not any(
request.path.startswith(p) for p in hide_toolbar_patterns
),
}


# Insert debug_toolbar middleware as first element
# https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#middleware
Expand Down

0 comments on commit b164559

Please sign in to comment.