Skip to content

Issue importing settings since 3.2.3 #1581

Closed
@jaredahern

Description

@jaredahern

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions