TemplateDoesNotExist at/****

TemplateDoesNotExist at /hello

hello.html
Request Method: GET
Request URL: http://127.0.0.1:8000/hello
Django Version: 1.8.18
Exception Type: TemplateDoesNotExist
Exception Value:
hello.html
Exception Loca \Python27\lib\site-packages\django-1.8.18-py2.7.egg\django\template\loader.py in get_template, line 46
Python Executable: \Python27\python.exe
Python Version: 2.7.14
Python Path:
['E:\\Work page\\HelloWorld',
 'C:\\Windows\\system32\\python27.zip',
 'D:\\Program Files\\Programs\\Python27\\DLLs',
 'D:\\Program Files\\Programs\\Python27\\lib',
 'D:\\Program Files\\Programs\\Python27\\lib\\plat-win',
 'D:\\Program Files\\Programs\\Python27\\lib\\lib-tk',
 'D:\\Program Files\\Programs\\Python27',
 'D:\\Program Files\\Programs\\Python27\\lib\\site-packages',
 'D:\\Program Files\\Programs\\Python27\\lib\\site-packages\\django-1.8.18-py2.7.egg']
Server time:

Mon, 29 Jan 2018 14:19:21 +0800




出错原因:访问不到templates里面的模板
解决方式
方法1、复制hello.html文件至安装路径下的Python27\\lib\\site-packages\\django-1.8.18-py2.7.egg文件下
启动服务python manage.py runserver 127.0.0.1:8000
运行http://127.0.0.1:8000/hello,错误解决。
方法2、文件夹templates复制到project项目文件夹下。




你可能感兴趣的:(Python)