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

Issue importing settings since 3.2.3 #1581

Closed
jaredahern opened this issue Jan 27, 2022 · 1 comment
Closed

Issue importing settings since 3.2.3 #1581

jaredahern opened this issue Jan 27, 2022 · 1 comment

Comments

@jaredahern
Copy link

Hello! I have a Django project in which I import the PANELS_DEFAULTS into the settings, modify it, and use it for DEBUG_TOOLBAR_PANELS. This simplifies the removal of any particular panel, as the defaults don't need to be hard-coded in our settings.

However, as of djdt 3.2.3, this no longer works. The following line in our settings.py file causes an AppRegistryNotReady error:

from debug_toolbar.settings import PANELS_DEFAULTS

If we change it to import debug_toolbar, I see an ImproperlyConfigured error related to missing SECRET_KEY.

I think this is because as of 3.2.3, debug_toolbar/__init__.py imports app_name, which ultimately imports the whole package. And perhaps that's not good to do that in a settings.py file. It might be that we can restructure our settings.py to make this work, but at the moment I'm guessing not.

Would it be possible to restructure things such that debug_toolbar.settings could be imported without triggering the import of other submodules? Perhaps put app_name by itself in a module that itself doesn't import anything? I'm happy to task a stab at this if someone indicates that it would be acceptable.

Or perhaps is there a different approach to "modifying" the default panel settings?

@matthiask
Copy link
Member

I noticed too that somehow more of the toolbar was imported earlier than previously.

I think there's no harm duplicating this string in both modules and keeping it synchronized. I submitted a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants