37,741
社区成员
发帖
与我相关
我的任务
分享TemplateDoesNotExist at /
users/index.htmlRequest Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.3.1
Exception Type: TemplateDoesNotExist
Exception Value: users/index.html
Exception Location: F:\Python27\lib\site-packages\django\template\loader.py in find_template, line 138
Python Executable: F:\Python27\python.exe
Python Version: 2.7.2
Python Path: ['F:\\Python27\\Django-1.3.1\\Django-1.3.1dasf\\django\\bin\\Django_Pro',
'F:\\Python27\\Lib\\site-packages\\wx-2.8-msw-unicode\\wxPython',
'C:\\WINDOWS\\system32\\python27.zip',
'F:\\Python27\\DLLs',
'F:\\Python27\\lib',
'F:\\Python27\\lib\\plat-win',
'F:\\Python27\\lib\\lib-tk',
'F:\\Python27',
'F:\\Python27\\lib\\site-packages',
'F:\\Python27\\lib\\site-packages\\win32',
'F:\\Python27\\lib\\site-packages\\win32\\lib',
'F:\\Python27\\lib\\site-packages\\Pythonwin',
'F:\\Python27\\lib\\site-packages\\wx-2.8-msw-unicode']
Server time: Thu, 15 Mar 2012 17:05:14 +0800
from django.conf.urls.defaults import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
(r'^$', 'Django_Pro.Users.views.index'),
#url(r'^Django_Pro/', include('Django_Pro.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# url(r'^admin/', include(admin.site.urls)),
)
#-*- coding:utf-8 -*-
from django.shortcuts import render_to_response
from Django_Pro.Users.models import Users
def index(rq):
#获取Users数据模型对应表中的数据
latest_users_list = Users.objects.all().order_by('-username')[:5]
return render_to_response('users/index.html',{'latest_users_list':latest_users_list})
<!DOCTYPE html PUBLIC "-//w3c//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>就是这样的</title>
<style type='text/css'>
table{border:1px solid #003366; border-width:1px 0 0 1px; margin:2px 0 2px 0; text-align:center; border-collapse:collapse;}
td,th{border:1px solid #003366; border-width:0 1px 1px 0;margin:2px 0 2px 0;text-align:center;background-color:#FFFFFF;}
th{text-align:center;font-weight:600;font-size:14px;background-color:#003366;color:#FFFFFF}
tr.t1 td {background-color:#fff;} /* 第一行的背景色*/
tr.t2 td {background-color:#eee;}
tr.t3 td {background-color:#ccc;}
</style>
</head>
<body>
<h2>通信录</h2>
<table width='100%' cellpadding='0' cellspacing='0' id='tab'>
<tr>
<th width='17%'>姓名</th>
<th width='17%'>性别</th>
<th width='22%'>年纪</th>
<th width='44%'>地址</th>
</tr>
{% for user in address %}
<tr>
<td>{{ user.name }}</td>
<td>{{ user.sex }}</td>
<td>{{ user.age }}</td>
<td>{{ user.address }}</td>
</tr>
{% endfor %}
</table>
<script type="text/javascript">
<!--
var Ptr=document.getElementById("tab").getElementsByTagName("tr");
function $(){
for(i=1; i<Ptr.length+1; i++){
Ptr[i-1].className = (i%2>0)?"t1":"t2";
}
}
window.onload=$;
for (Var i=0; i<Ptr.length; i++){
Ptr[i].onmouseover=function(){
this.tmpClass = this.className;
this.className = "t3";
};
Ptr[i].onmouseout=function(){
this.className=this.tmpClass;
};
}
//-->
</script>
</body>
</html>
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'blogapp/tpl').replace('\\','/'),
)
TemplateDoesNotExist at /
/users/index.htmRequest Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.3.1
Exception Type: TemplateDoesNotExist
Exception Value: /users/index.htm
Exception Location: F:\Python27\lib\site-packages\django\template\loader.py in find_template, line 138
Python Executable: F:\Python27\python.exe
Python Version: 2.7.2
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'./templates',