Commit e8f37050 authored by Florent Chehab's avatar Florent Chehab

Restored django debug toolbar in the api panel

parent b740f2dd
Pipeline #36186 passed with stages
in 4 minutes and 35 seconds
......@@ -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/"]
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment