My settings.py file looks like-
import os
# This file contains Django settings for lower environments that use the Django Debug Toolbar.
# Currently those envronments are DEV and QA.
from core.settings import * # noqa: F403
# We need the ability to disable debug_toolbar for regression tests.
DEBUG = os.getenv('DEBUG_MODE', 'FALSE').upper() == 'TRUE'
def toolbar_callback(request):
return DEBUG
DEBUG_TOOLBAR_CONFIG = {
"SHOW_TOOLBAR_CALLBACK": toolbar_callback,
}
INSTALLED_APPS += ['debug_toolbar', ] # noqa: F405
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware', ] # noqa: F405
I want to exclude certain pages from loading debug toolbar. The reason being that the pages have a lot of SQL and debug toolbar is taking too long to load and hence page results in a timeout