我正在为基于 Django 的博客设置 RSS 提要。尝试访问 URL 时出现 500 个错误:
$ curl -I http://172.16.91.140:8000/blogg/feeds/latest/
HTTP/1.0 500 INTERNAL SERVER ERROR
WSGIServer 报告的不过是
[25/Aug/2011 20:21:41] "HEAD /blogg/feeds/latest/ HTTP/1.1" 500 0
在 blogg/ 我有两个文件:
提要.py:
from django.contrib.syndication.feeds import Feed
from blog.models import *
class BlogFeed(Feed):
title = "Test Title"
link = "/sitenews/"
description = "Test Description"
def items(self):
return Blog.objects.filter( is_published = True ).order_by('-id')[:10]
def item_title(self, item):
return item.subject
def item_description(self, item):
return item.subject
def item_pubdate(self,item):
return item.blog_time
和 urls.py
from django.conf.urls.defaults import patterns, include, url
from blog.feeds import *
feeds = {
'latest': feeds.BlogFeed,
}
urlpatterns = patterns('blog.views',
(r'^$', 'index'),
(r'^(?P<blog_id>\d+)/$', 'detail'),
(r'^past-bloggs/', 'country_listing'),
(r'^past-bloggs/(?P<country_name>\w+)/$', 'city_listing'),
)
urlpatterns += patterns('',
url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}, name='feeds'),
)
知道我哪里可能出错了吗?多谢你们。