MCPcopy
hub / github.com/django/django / get_template_directories

Function get_template_directories

django/template/autoreload.py:10–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9
10def get_template_directories():
11 # Iterate through each template backend and find
12 # any template_loader that has a 'get_dirs' method.
13 # Collect the directories, filtering out Django templates.
14 cwd = Path.cwd()
15 items = set()
16 for backend in engines.all():
17 if not isinstance(backend, DjangoTemplates):
18 continue
19
20 items.update(cwd / to_path(dir) for dir in backend.engine.dirs if dir)
21
22 for loader in backend.engine.template_loaders:
23 if not hasattr(loader, "get_dirs"):
24 continue
25 items.update(
26 cwd / to_path(directory)
27 for directory in loader.get_dirs()
28 if directory and not is_django_path(directory)
29 )
30 return items
31
32
33def reset_loaders():

Callers 2

template_changedFunction · 0.85

Calls 5

to_pathFunction · 0.90
is_django_pathFunction · 0.90
allMethod · 0.45
updateMethod · 0.45
get_dirsMethod · 0.45

Tested by

no test coverage detected