例如,我的django项目中有2个应用程序,模板和具有相同子路径的静态文件:
app1 /
static /
style.css
templates /
index.html
app2 /
static /
style.css
templates /
index.html
Run Code Online (Sandbox Code Playgroud)
比在settings.py中我添加了这两个应用:
INSTALLED_APPS = (
'app1',
'app2',
)
Run Code Online (Sandbox Code Playgroud)
现在我在模板中以某种方式使用'style.css'和'index.html',例如
{% include 'index.html' %}
Run Code Online (Sandbox Code Playgroud)
所以,问题是:
Django是否保证当我引用'style.css'或'index.html'时会使用来自app2子目录的文件?
在这种情况下,是否有任何其他方式指出Django文件的优选变体?
django ×1