Skip to content

Using Django's cached template loader causes an exception in the templates panel #660

Closed
@kezabelle

Description

@kezabelle

Given:

TEMPLATE_LOADERS = (
    ('django.template.loaders.cached.Loader', (
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
    )),
)
  • Open a page which shows djdt
  • Open the templates panel (obviously, this panel needs to be enabled)
  • Try and view one of the templates used.
  • You should receive a 500 ISE.
NotImplementedError at /__debug__/template_source/
subclasses of BaseLoader must provide a load_template_source() method
Django Version: 1.7.1
Python Version: 2.7.6
Traceback:
File "/SITE_PACKAGES/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/SITE_PACKAGES/debug_toolbar/panels/templates/views.py" in template_source
  27.             source, display_name = loader.load_template_source(template_name)
File "/SITE_PACKAGES/django/template/loader.py" in load_template_source
  65.         raise NotImplementedError('subclasses of BaseLoader must provide a load_template_source() method')

Which makes some amount of sense, as the caching Loader doesn't implement load_template_source (arguably upstream could make a change to provide one, though, possibly by just re-calling find_template)

There may very well be nothing that can done in djdt, but I couldn't see any documentation caveats that explain as much (having searched RTD and google), and it was a bit confusing, given that the template panel appeared to work fine -- showed the correct templates used, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions