# Default template searching in subfolders

**URL:** <https://forum.djangoproject.com/t/default-template-searching-in-subfolders/17869>\
**Category:** Templates & Frontend\
**Created:** [December 27, 2022, 6:21pm UTC](https://forum.djangoproject.com/t/default-template-searching-in-subfolders/17869 "2022-12-27T18:21:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kanapka12](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kanapka12/32/8532_2.png) [@Kanapka12](https://forum.djangoproject.com/u/Kanapka12)\
**Post date:** [December 27, 2022, 6:21pm UTC](https://forum.djangoproject.com/t/default-template-searching-in-subfolders/17869/1 "2022-12-27T18:21:01Z")

</div>

I am using class-based views and I would like to avoid typing full paths for the template\_name. By default, Django searches for templates in templates/english (english is the name of my app), but I would like it to also search in subdirectories. How can I do that?

---

<div class="post-metadata">

**Author:** ![onyeibo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/onyeibo/32/11494_2.png) [@onyeibo](https://forum.djangoproject.com/u/onyeibo)\
**Post date:** [December 27, 2022, 7:01pm UTC](https://forum.djangoproject.com/t/default-template-searching-in-subfolders/17869/2 "2022-12-27T19:01:36Z")

</div>

in template:

```auto
{% load static %}

...
<img src="{% static 'english/subdirectory/image.png'%}">

```

---

<div class="post-metadata">

**Author:** ![Kanapka12](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kanapka12/32/8532_2.png) [@Kanapka12](https://forum.djangoproject.com/u/Kanapka12)\
**Post date:** [December 27, 2022, 7:15pm UTC](https://forum.djangoproject.com/t/default-template-searching-in-subfolders/17869/3 "2022-12-27T19:15:18Z")

</div>

You misunderstood me, I want my class based views to know to search for templates also in subdirectories to avoid typing the full paths of these templates in the template\_name attribute

---

<div class="post-metadata">

**Author:** ![onyeibo](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/onyeibo/32/11494_2.png) [@onyeibo](https://forum.djangoproject.com/u/onyeibo)\
**Post date:** [December 27, 2022, 7:22pm UTC](https://forum.djangoproject.com/t/default-template-searching-in-subfolders/17869/4 "2022-12-27T19:22:44Z")

</div>

oh. I’ve always specified full paths on CBvs. The paths are usually not long

`template_name = "english/page.html"`

that should do it. No need to specify the template root

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [December 27, 2022, 7:37pm UTC](https://forum.djangoproject.com/t/default-template-searching-in-subfolders/17869/5 "2022-12-27T19:37:50Z")

</div>

That would be an extremely _bad_ idea in the context of how Django works.

Keep in mind that Django will search through **all** directories specified in the [TEMPLATES](https://docs.djangoproject.com/en/4.1/ref/settings/#templates) setting _not_ just the directory for the current app. It’s this feature that allows an app to [override the templates](https://docs.djangoproject.com/en/4.1/howto/overriding-templates/#how-to-override-templates) being used by other apps. So in that sense, the directory names form a namespace for templates to be organized and identified by app or as a feature within an app.
