[Django]-How does django know how to find templates? (1.2x)

3👍

You either did not add the contact application to your INSTALLED_APPS in settings.py OR you are trying to load the template from one application inside another application. The TEMPLATE_DIRS is where to look if it doesn’t find the template inside the same application as the views are loading from.

3👍

Probably because a Template Loader knows how to find it. The app_directories one will find the templates directory in each application.

django.template.loaders.filesystem.Loader will use the TEMPLATE_DIRS setting.

django.template.loaders.app_directories.Loader will find the templates directory in your installed apps.

If the first loader in the TEMPLATE_LOADERS setting can’t find it, Django will ask the next to see if it can find it.

How are you telling your views which templates you’re using?

1👍

I expect your books app is in INSTALLED_APPS, but contact is not.

Leave a comment