Python 使用django的服务器上没有输出
my views.py文件代码:Python 使用django的服务器上没有输出,python,django,linux,ubuntu-10.04,Python,Django,Linux,Ubuntu 10.04,my views.py文件代码: #!/usr/bin/python from django.template import loader, RequestContext from django.http import HttpResponse #from skey import find_root_tags, count, sorting_list from search.models import Keywords from django.shortcuts import render_
#!/usr/bin/python
from django.template import loader, RequestContext
from django.http import HttpResponse
#from skey import find_root_tags, count, sorting_list
from search.models import Keywords
from django.shortcuts import render_to_response as rr
def front_page(request):
if request.method == 'POST' :
from skey import find_root_tags, count, sorting_list
str1 = request.POST['word']
fo = open("/home/pooja/Desktop/xml.txt","r")
for i in range(count.__len__()):
file = fo.readline()
file = file.rstrip('\n')
find_root_tags(file,str1,i)
list.append((file,count[i]))
sorting_list(list)
for name, count1 in list:
s = Keywords(file_name=name,frequency_count=count1)
s.save()
fo.close()
list1 = Keywords.objects.all()
t = loader.get_template('search/results.html')
c = Context({'list1':list1,})
return HttpResponse(t.render(c))
else :
str1 = ''
list = []
template = loader.get_template('search/front_page.html')
c = RequestContext(request)
response = template.render(c)
return HttpResponse(response)
<body BGCOLOR = #9ACD32">
<ul>
{ % for l in list1 %}
<li> {{l.file_name}}, {{l.frquency_count}}</li>
{ % endfor %}
</ul>
</body>
为什么会发生这种情况,我错在哪里了?虽然值存储在表中,但我通过管理页面检查了它,然后为什么显示它?
请帮忙
{ % for l in list1 %}
应该是
{% for l in list1 %}
{% endfor %}
及
应该是
{% for l in list1 %}
{% endfor %}
永远不要在两个字母之间留空格{'和“%”请任何人帮我解决这个问题,我遗漏了什么?顺便说一句:过去几天,我已经多次看到同一个代码片段,我看到了一些东西,我怀疑我很快就会再次看到它。我不是有意粗鲁,我明白我们总有一天会从某个地方开始,而且这并不明显,我知道我自己还有很多东西要学——但说真的,你最近提出的大多数问题都是关于你本可以通过谷歌搜索、阅读和奉献来解决的问题。