Django RSS feed 500 错误
我正在为我的基于 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/ 下,我有两个文件:
feeds.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'),
)
知道我可能在哪里出错吗?谢谢你们。
I'm working on setting up an RSS feed for my Django-based blog. I'm getting 500 errors when I try and access the URL:
$ curl -I http://172.16.91.140:8000/blogg/feeds/latest/
HTTP/1.0 500 INTERNAL SERVER ERROR
WSGIServer is reporting nothing more than
[25/Aug/2011 20:21:41] "HEAD /blogg/feeds/latest/ HTTP/1.1" 500 0
Under blogg/ I've got two files:
feeds.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
and urls.py
from django.conf.urls.defaults import patterns, include, url
from blog.feeds import *
feeds = {
'latest': feeds.BlogFeed,
}
urlpatterns = patterns('blog.views',
(r'^
Any idea where I could be going wrong? Thanks guys.
, 'index'),
(r'^(?P<blog_id>\d+)/
Any idea where I could be going wrong? Thanks guys.
, 'detail'),
(r'^past-bloggs/', 'country_listing'),
(r'^past-bloggs/(?P<country_name>\w+)/
Any idea where I could be going wrong? Thanks guys.
, 'city_listing'),
)
urlpatterns += patterns('',
url(r'^feeds/(?P<url>.*)/
Any idea where I could be going wrong? Thanks guys.
, 'django.contrib.syndication.views.feed', {'feed_dict': feeds}, name='feeds'),
)
Any idea where I could be going wrong? Thanks guys.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了这个问题。调用
意味着存在无效属性,我将其更改为
School boy error。抱歉,我没有也包括我的模型。有时写下问题会让我注意到一些我忽略的事情。大家编码愉快!
I found the issue. Calling
Meant there was an invalid property, I changed it to
School boy error. Sorry I hadn't included my model as well. Sometimes writing out a problem will cause me to notice something I've overlooked. Happy coding everyone!