Skip to content

False positive for debug_toolbar.W006? #1550

Closed
@leon-matthews

Description

@leon-matthews

After upgrading to v3.2.3 I get the system warning W006, and an advisement to set APP_DIRS=True for at least one of my template settings.

Shouldn't that check also be looking at the value of loaders in order to avoid false warnings?

For example, the project in question had the following template settings:

TEMPLATES = [{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [SITE_ROOT / 'templates'],
    'OPTIONS': {
        'builtins': [
            'django.templatetags.static',
            'common.templatetags.builtins',
        ],
        'context_processors': [
            'common.context_processors.constants',
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.template.context_processors.media',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
        ],
        'loaders': [
            'django.template.loaders.filesystem.Loader',
            'django.template.loaders.app_directories.Loader',
        ],
    },
}]

Django Debug Toolbar works wonderfully with these settings. My understanding is that the app_directories loader is able to find the templates that the toolbar needs. The W0006 warning seems to be a false postive here (but to be honest, it's been a couple of years since I created this config).

As a quick experiment I tried just deleting the loaders option and adding the suggested APP_DIRS setting. It resulted in a key error for 'django' during deployment while trying to run migrate - so I've reverted back to v3.2.2 for now.

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