【发布时间】:2018-02-04 00:06:31
【问题描述】:
我刚开始学习 Django,正在学习 Learn Django 1.11 教程。
这是我当前的项目树:
├── manage.py
├── muypicky
│ ├── __init__.py
│ ├── old_settings.py
│ ├── settings
│ │ ├── base.py # Contains the settings (like shown in the tutorial)
│ │ ├── __init__.py
│ ├── urls.py
│ └── wsgi.py
├── requirements.txt
├── restaurants
└── templates # Templates Folder
└── index.html
我正在尝试将路径添加到设置文件夹中的模板文件夹。但是显示的错误
django.template.loaders.filesystem.Loader: .../muypicky/tempelates/index.html(源不存在)
当前的setting.py文件
TEMPLATES = [{
'DIRS': [os.path.join(BASE_DIR, 'tempelates')],
},]
查看错误,文件路径错误,因为它进入了不正确的 /muypicky/tempelates。那么如何使用setting.py(base.py)中的给定文件树进入根文件夹,然后进入模板文件夹。
如有任何进一步的疑问,请尽管询问,非常感谢。
【问题讨论】:
-
如果您自己的名字保持一致,这可能会有所帮助。你的意思是
Templates还是Tempelates?