Python的Django框架入门踩过的坑(四)

模板不存在的错误,从views找模板方法,必须写好路径,

和views的方法render()跳转的路径一样

TemplateDoesNotExist at /index2/
base.html
Request Method: GET
Request URL: http://127.0.0.1:8000/index2/
Django Version: 1.8.2
Exception Type: TemplateDoesNotExist
Exception Value:
base.html
Exception Location: /home/python/.virtualenvs/h1/local/lib/python2.7/site-packages/django/template/engine.py in find_template, line 146
Python Executable: /home/python/.virtualenvs/h1/bin/python
Python Version: 2.7.12
Python Path:
['/home/python/Desktop/django/test4',
 '/home/python/.virtualenvs/h1/lib/python2.7',
 '/home/python/.virtualenvs/h1/lib/python2.7/plat-x86_64-linux-gnu',
 '/home/python/.virtualenvs/h1/lib/python2.7/lib-tk',
 '/home/python/.virtualenvs/h1/lib/python2.7/lib-old',
 '/home/python/.virtualenvs/h1/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/home/python/.virtualenvs/h1/local/lib/python2.7/site-packages',
 '/home/python/.virtualenvs/h1/lib/python2.7/site-packages']
Server time: Sat, 31 Mar 2018 05:28:31 +0000

猜你喜欢

转载自blog.csdn.net/chenhua1125/article/details/79873524