【发布时间】:2015-08-10 09:52:02
【问题描述】:
DJANGO 1.8 Python 3.4
我之前遇到过 TEMPLATES 数组设置生成错误“找不到模板”,而 Django 模板加载器实际上报告它找到了模板。我可以通过恢复到 TEMPLATE_DIRS 设置来解决这个问题。See the Question
我需要调试一个模板,所以我将 TEMPLATE_DEBUG 设置为 True...,它再次生成 Template not found 错误:
index.html
请求方法:GET 请求网址:http://127.0.0.1:7000/ Django 版本:1.8.2 异常类型:TemplateDoesNotExist 异常值:
index.html
Exception Location: /home/sdr/sl/lib/python3.4/site-packages/django/template/loader.py in render_to_string, line 138
Python Executable: /home/sdr/sl/bin/python
Python Version: 3.4.3
Python Path:
['/home/sdr/sl/agryp',
'/home/sdr/pycharm-4.5/helpers/pydev',
'/home/sdr/sl/src/tastypie',
'/home/sdr/sl/agryp',
'/usr/local/lib/python34.zip',
'/usr/local/lib/python3.4',
'/usr/local/lib/python3.4/plat-linux',
'/usr/local/lib/python3.4/lib-dynload',
'/home/sdr/sl/lib/python3.4/site-packages']
Server time: Thu, 28 May 2015 04:05:11 +0000
Template-loader postmortem
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/home/sdr/sl/agryp/templates/index.html (File exists)
无论我使用 TEMPLATES=[] 设置还是 TEMPLATE_DIRS 设置,错误仍然存在。
我希望能深入了解这个问题。
【问题讨论】:
标签: django debugging templates