django.template.loaders.app_directories.Loader无法找到模板文件

vts*_*vts 8 django django-templates

模板文件保存在app目录下,但在呈现时会引发TemplateDoesNotExist异常:

模板加载器postmortem如下:

Django尝试按以下顺序加载这些模板:

Using loader django.template.loaders.app_directories.Loader:
    ...
    $PROJECT/apps/myapp/templates/search.html (File does not exist)
    ...
Run Code Online (Sandbox Code Playgroud)

我想知道为什么它寻找:

$PROJECT/apps/myapp/templates/search.html
Run Code Online (Sandbox Code Playgroud)

而不是:

$PROJECT/apps/myapp/templates/myapp/search.html
Run Code Online (Sandbox Code Playgroud)

后者确实存在

Bab*_*abu 6

$PROJECT/apps/myapp/templates/search.html.正如医生所说,这就是它所寻找的道路.

django.template.loaders.app_directories.Loadertemplates在所有INSTALLED_APPS顺序中查找目录.