Opened 5 years ago

Closed 5 years ago

Last modified 5 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


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 Changed 5 years ago by Tim Graham

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 Changed 5 years ago by Sven R. Kunze

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