[Django]-Django debug-toolbar – Can't make it work (ImproperlyConfigured: The STATICFILES_DIRS …)

8👍

Django debug toolbar chokes when using S3BotoStorage. I mostly wanted SQL logging, so adding this code to settings.py to disable the StaticFilesPanel was a workaround for me:

DEBUG_TOOLBAR_PANELS = [
 'debug_toolbar.panels.versions.VersionsPanel',
 'debug_toolbar.panels.timer.TimerPanel',
 'debug_toolbar.panels.settings.SettingsPanel',
 'debug_toolbar.panels.headers.HeadersPanel',
 'debug_toolbar.panels.request.RequestPanel',
 'debug_toolbar.panels.sql.SQLPanel',
 # 'debug_toolbar.panels.staticfiles.StaticFilesPanel',                                                                                                                                    
 'debug_toolbar.panels.templates.TemplatesPanel',
 'debug_toolbar.panels.cache.CachePanel',
 'debug_toolbar.panels.signals.SignalsPanel',
 'debug_toolbar.panels.logging.LoggingPanel',
 'debug_toolbar.panels.redirects.RedirectsPanel',
]

0👍

This django-debug-toolbar explicit-setup
Says something about:

from django.conf import settings
from django.conf.urls import include, patterns, url

if settings.DEBUG:
    import debug_toolbar
    urlpatterns += patterns('',
        url(r'^__debug__/', include(debug_toolbar.urls)),
    )

Have you tried?

0👍

I had encountered the same error when I created custom storage using lambda:

StaticRootS3BotoStorage = lambda: S3Boto3Storage(bucket_name='example-name') 

Changing it to class solved the problem:

class StaticRootS3BotoStorage(S3Boto3Storage):
    bucket_name='example-name'

0👍

pip install django-debug-toolbar

check your settings.py file :

INSTALLED_APPS = [
    'django.contrib.staticfiles',
     'debug_toolbar',


...

MIDDLEWARE = [
    "debug_toolbar.middleware.DebugToolbarMiddleware",
    ...
]

...

INTERNAL_IPS = [
    "127.0.0.1",
]
...

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATIC_URL = '/static/'

# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static/'),
)

urls.py

path("__debug__/", include(debug_toolbar.urls)),

And run this command : python manage.py collectstatic

👤Ayse

Leave a comment