Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cms/envs/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
)

DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False
'INTERCEPT_REDIRECTS': False,
'SHOW_TOOLBAR_CALLBACK': 'check_debug.should_show_debug_toolbar',
}

# To see stacktraces for MongoDB queries, set this to True.
Expand Down
14 changes: 14 additions & 0 deletions common/lib/check_debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
Function to check debug status.
"""
import os

def should_show_debug_toolbar(request):
"""
Return True/False to determine whether to show the Django
Debug Toolbar.

If HIDE_TOOLBAR is set in the process environment, the
toolbar will be hidden.
"""
return not bool(os.getenv('HIDE_TOOLBAR', ''))
2 changes: 1 addition & 1 deletion lms/envs/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

DEBUG_TOOLBAR_CONFIG = {
'INTERCEPT_REDIRECTS': False,
'SHOW_TOOLBAR_CALLBACK': lambda _: True,
'SHOW_TOOLBAR_CALLBACK': 'check_debug.should_show_debug_toolbar',
Copy link

Choose a reason for hiding this comment

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

dev.py just doesn't specify SHOW_TOOLBAR_CALLBACK; is there a compelling reason to add this? If so, then make the other environments match.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There already was a SHOW_TOOLBAR_CALLBACK in devstack but not in dev. I don't use dev settings. The compelling reason is that the toolbar won't show up in devstack otherwise.

Copy link

Choose a reason for hiding this comment

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

This should be added to cms/envs/devstack.py as well, then.

}

########################### PIPELINE #################################
Expand Down