5👍
The docs have an excellent explanation of this:
By default, the templating system will
read and compile your templates every
time they need to be rendered. While
the Django templating system is quite
fast, the overhead from reading and
compiling templates can add up.The cached template loader is a
class-based loader that you configure
with a list of other loaders that it
should wrap. The wrapped loaders are
used to locate unknown templates when
they are first encountered. The cached
loader then stores the compiled
Template in memory. The cached
Template instance is returned for
subsequent requests to load the same
template.For example, to enable template caching with the filesystem and app_directories template loaders you might use the following settings:
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
)