【发布时间】:2018-06-19 13:27:19
【问题描述】:
我重新组织了 Django,如下方式:
config
- settings
- base.py
- local.py
urls.py
wsgi.py
还有应用程序:
- apps(level0)
- acc(level_1)
- users(level_2)
- templates
- users
- acc_control(level_2)
-att(level_1)
- notes (level_2)
- notifications (level_2)
- mark(level_1)
- config (level0)
- templates(level0)
一些应用程序直接在应用程序文件夹中,前标记,其他应用程序在其他子文件夹中,前用户
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')]
我的问题与模板访问有关,因为我收到以下错误:
\apps\acc\users\templates\users\templates\users\detail.html (Source does not exist)
正在重复内部文件夹;
View中的模板设置为:
template_name = 'users/templates/users/detail.html'
我也试过了:
template_name = '/users/detail.html'
【问题讨论】:
-
这里没什么好说的。在错误页面中,您有一个很好的键值对表,显示每个设置配置的值是什么。对照您的实际路径检查并进行相应调整。
标签: django django-templates django-settings