Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26507 closed New feature (duplicate)

Add autoreloading to the cached template loader

Reported by: Sven R. Kunze Owned by: nobody
Component: Template system Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

A while ago, we started using {{ django.template.loaders.cached.Loader }} for performance reasons.

Today, we noticed that we needed to restart the runserver each time we changed the template.

Would you accept a patch to the cached.Loader which respects the mtime of a loaded template?

Change History (2)

comment:1 by Tim Graham, 8 years ago

Component: Core (Cache system)Template system
Resolution: duplicate
Status: newclosed
Summary: django.template.loaders.cached.Loader respecting mtime of templatesAdd autoreloading to the cached template loader

Duplicate of #25791

comment:2 by Sven R. Kunze, 8 years ago

Thanks Tim for finding the related issue.

I don't know if I would agree with the new title. Actually, I do not want to reload/replace the already loaded template.

Looking at the source, I would say, we could make 'Loader.cache_key' respect the mtime of the first found template.

So, they are two versions of the template in the cache but a cache does not need to be perfect after all and the increased memory footprint would not even matter in development.

Note: See TracTickets for help on using tickets.
Back to Top