Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make defaults importable without side-effects #801

Closed
blueyed opened this issue Jan 19, 2016 · 5 comments
Closed

Make defaults importable without side-effects #801

blueyed opened this issue Jan 19, 2016 · 5 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Jan 19, 2016

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.

@blueyed blueyed changed the title Make defaults (PANELS_DEFAULTS) importable without side-effects Make defaults importable without side-effects Jan 19, 2016
@leotsem
Copy link

leotsem commented Jan 27, 2016

+1. Getting the same (weird) exception.

@aaugustin
Copy link
Contributor

Does this pull request work for you?

@aaugustin
Copy link
Contributor

Is anyone interested in the patch I submitted above, or should I just drop it and close this issue?

@blueyed
Copy link
Contributor Author

blueyed commented Jun 1, 2016

@aaugustin
Sure. Sorry for not providing feedback earlier.

I've tested the PR now, and it allows for from debug_toolbar import settings as dt_settings without raising an exception about the missing SECRET_KEY.
Thanks!

@aaugustin
Copy link
Contributor

Thanks for testing!

ryneeverett pushed a commit to ryneeverett/django-debug-toolbar that referenced this issue Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants