【发布时间】:2016-08-23 13:12:32
【问题描述】:
我有一个可重用的应用程序,其目录结构如下:
myapp/
myapp/
views.py
models.py
...etc
templates/
myapp/
template1.html
...etc
admin/
index.html
test/
...testing stuff
setup.py
...etc
我将覆盖 index.html 管理模板,以便我可以在 {% block userlinks %} 中添加一些其他链接,这些链接将在项目使用我的应用程序时出现在项目的导航中。
但是,当在项目中使用我的应用程序时,管理主页仍然使用 Django 自己的 index.html 文件。项目本身有一个它使用的base_site.html,但模板继承图(在django-debug-toolbar 中)如下所示:
/path/to/virtualenv/django/contrib/admin/templates/admin/index.html
/projectpath/projectname/templates/admin/base_site.html
/path/to/virtualenv/django/contrib/admin/templates/admin/base.html
...第一个条目应该是我的应用程序模板目录中的index.html 文件!有谁知道为什么找不到它?如果需要,我可以发布设置。
【问题讨论】:
标签: python django django-templates django-admin