Skip to content

Commit 5aaf8f7

Browse files
committed
Use django-debug-toolbar 6.1 or later for better support of debugging with Docker
1 parent f4d40cd commit 5aaf8f7

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

aplus/settings.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,9 @@
616616
INTERNAL_IPS.append('127.0.0.1')
617617
except NameError:
618618
INTERNAL_IPS = ['127.0.0.1']
619-
try:
620-
# pylint: disable-next=used-before-assignment
621-
DEBUG_TOOLBAR_CONFIG.setdefault('SHOW_TOOLBAR_CONFIG', 'lib.helpers.show_debug_toolbar')
622-
except NameError:
623-
DEBUG_TOOLBAR_CONFIG = {
624-
'SHOW_TOOLBAR_CALLBACK': 'lib.helpers.show_debug_toolbar',
625-
}
619+
# Configure Debug Toolbar to work under Docker by auto-detecting the gateway IP
620+
# See: https://django-debug-toolbar.readthedocs.io/en/latest/installation.html#docker
621+
if 'DEBUG_TOOLBAR_CONFIG' not in globals():
622+
DEBUG_TOOLBAR_CONFIG = {}
623+
# Always use the Docker-aware callback so toolbar shows when accessed via localhost
624+
DEBUG_TOOLBAR_CONFIG.setdefault('SHOW_TOOLBAR_CALLBACK', 'debug_toolbar.middleware.show_toolbar_with_docker')

requirements_testing.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ coverage
33
# Required to run browser tests:
44
selenium
55
pyvirtualdisplay
6-
django-debug-toolbar >= 3.2.2, < 4
6+
django-debug-toolbar >= 6.1.0, < 7
77
prospector
88
pytest-playwright
99
pytest-django

0 commit comments

Comments
 (0)