Py学习  »  问与答

手动创建的TEMPLATE_DIRS中一直出问题,求帮助

取个昵称不够长 • 10 年前 • 8196 次点击  

手动创建的TEMPLATE_DIRS中: 一开始是这样写的: '/home/tooweakchen/dblog/templates', 后来改成是这样写的: os.path.join(BASE_DIR,'./dblog/templates'), 这个templates是与manage.py同级,但是两者报的错误相同,如下所示:

TemplateDoesNotExist at / index.html Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.8 Exception Type: TemplateDoesNotExist Exception Value:
index.html Exception Location: /usr/local/lib/python2.7/dist-packages/Django-1.8-py2.7.egg/django/template/loader.py in render_to_string, line 138 Python Executable: /usr/bin/python2.7 Python Version: 2.7.6 Python Path:
['/home/tooweakchen/dblog', '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg', '/home/tooweakchen/dblog', '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/autopep8-1.1.1-py2.7.egg', '/usr/local/lib/python2.7/dist-packages/pep8-1.6.2-py2.7.egg', '/home/tooweakchen/.eclipse/org.eclipse.platform_3.8_155965261/plugins/org.python.pydev_3.9.2.201502050007/pysrc/pydev_sitecustomize', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/local/lib/python2.7/dist-packages/Django-1.8-py2.7.egg', '/usr/lib/python2.7/lib-old', '/usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg'] Server time: Mon, 11 May 2015 00:01:31 +0800 Template-loader postmortem

Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: Using loader django.template.loaders.app_directories.Loader: /usr/local/lib/python2.7/dist-packages/Django-1.8-py2.7.egg/django/contrib/admin/templates/index.html (File does not exist) /usr/local/lib/python2.7/dist-packages/Django-1.8-py2.7.egg/django/contrib/auth/templates/index.html (File does not exist)

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/1075
 
8196 次点击  
文章 [ 7 ]  |  最新文章 9 年前