我是Django的新手。我在Python 2.7中使用Django 1.8.6。我正在嘗試使用一個base.html模板,該模板可以在整個網站中全局使用,每個應用程序都可以訪問它並訪問它。這裏是我的測試網站的當前結構:Django Global base.html模板
twms
投票
遷移
靜態
模板
項目
遷移
靜態
模板
項目
的index.html
tmws
靜態
模板
tmws
base.html文件
這裏是項目/模板/項目/ index.html的
{% extends 'tmws/base.html' %}
{% block content %}
<h1>Projects</h1>
<ul>
{% for project in project_list %}
<li><a href="{% url 'project:detail' project.id %}">{{ project.name }}</a></li>
{% endfor %}
</ul>
end of list
{% endblock %}
代碼這是我收到的錯誤:
TemplateDoesNotExist在/項目/
tmws/base。 html
如何從我的任何應用程序訪問tmws/tmws/templates/tmws/base.html?
任何幫助將不勝感激!
讓我知道是否需要任何其他信息。
編輯
這裏是我的模板設置從settings.py:在您的設置
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'), # If i leave both or just comment one one out I still get the same error
'tmws.tmws.templates'
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
你有什麼在你的模板設置? –