Skip to content

Make defaults importable without side-effects #801

Closed
@blueyed

Description

@blueyed

I am trying to use / add to debug_toolbar.settings.PANELS_DEFAULTS with django-configurations, but it cannot be imported during setting up the settings:

@classmethod
def setup(cls):
    super().setup()
    from debug_toolbar import settings as dt_settings
    cls.DEBUG_TOOLBAR_PANELS = (
        ['debug_toolbar.panels.profiling.ProfilingPanel'] +
        dt_settings.PANELS_DEFAULTS)

The problem seems to be with the following code:

USER_CONFIG = getattr(settings, 'DEBUG_TOOLBAR_CONFIG', {})

(from https://github.com/django-debug-toolbar/django-debug-toolbar/blob/8f75a7b980d150fc554053d76e0438edd6e40f02/debug_toolbar/settings.py#L42)

It triggers the following exception:

django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

It would be good if PANELS_DEFAULTS (and possibly other defaults) could be imported without side-effects.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions