Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
e8f37050
Commit
e8f37050
authored
Mar 10, 2019
by
Florent Chehab
Browse files
Restored django debug toolbar in the api panel
parent
b740f2dd
Pipeline
#36186
passed with stages
in 4 minutes and 35 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
backend/base_app/settings.py
View file @
e8f37050
...
...
@@ -54,6 +54,8 @@ if os.environ["ENV"] == "DEV":
INSTALLED_APPS
+=
[
"django_extensions"
,
"debug_toolbar"
]
MIDDLEWARE
=
[
"debug_toolbar.middleware.DebugToolbarMiddleware"
]
+
MIDDLEWARE
DEBUG_TOOLBAR_CONFIG
=
{
"SHOW_TOOLBAR_CALLBACK"
:
"base_app.utils.show_toolbar"
}
else
:
DEBUG
=
False
...
...
@@ -66,7 +68,6 @@ WEBPACK_LOADER = {
}
ALLOWED_PHOTOS_EXTENSION
=
[
"jpg"
,
"jpeg"
,
"png"
,
"svg"
]
INTERNAL_IPS
=
[
"127.0.0.1"
]
LOGIN_URL
=
"/user/login"
LOGIN_EXEMPT_URLS
=
[
LOGIN_URL
,
"/admin/"
]
...
...
backend/base_app/utils.py
0 → 100644
View file @
e8f37050
def
show_toolbar
(
request
)
->
bool
:
"""
Function to tell when to show the django debug toolbar.
It was having an issue inside docker.
The django debug toolbar is displayed only when in /api/...
"""
if
request
.
is_ajax
():
return
False
url
=
request
.
get_full_path
()
return
"/api/"
in
url
or
"__debug__"
in
url
return
True
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment