26.5.1 Caching Template Files
Instead of loading templates each time we need one, we can cache any template we load into memory. This means that any subsequent load and render of the template will avoid any disk IO and will instead load the template file from memory. This approach is much, much quicker.
All of the settings for templates can be found in the TEMPLATES setting in suorganizer/settings.py. By default, Django does not list the template loaders used to get and fetch files. Instead, it supplies the key-value 'APP_DIRS': True, which is a shortcut to the app_directories.Loader we are about to add in Example 26.41. If we delete the APP_DIRS key, we can then explicitly set the values for loaders under OPTIONS.
Example 26.41: Project Code ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access