开发者

Django simple syndication example gives: ImportError, cannot import name Feed

开发者 https://www.devze.com 2022-12-25 22:23 出处:网络
I\'m trying to set up the simple syndication example from the Django docs, in a working project. But I\'m getting an ImportError, even though I\'m sure I\'ve copied the example exactly.

I'm trying to set up the simple syndication example from the Django docs, in a working project. But I'm getting an ImportError, even though I'm sure I've copied the example exactly.

Here's what I have in feeds.py:

from django.contrib.syndication.views import Feed 
class LatestEntriesFeed(Feed):
    # etc

And here's what I have in urls.py:

from election.feeds import LatestEntriesFeed
#... further down, at the appropriate line...
    # RSS feed
    (r'^feed/$', LatestEntriesFeed()),

But Django says it can't import the Feed class from django.contrib.syndication.views:

ImportError at /feed/
cannot import name Feed
....feeds.py in <module>
from django.contrib.syndication.views import Feed  开发者_运维知识库

Any ideas? I'm baffled!


That documentation is for the development version. Feeds have changed quite a lot in preparation for 1.2. If you're using 1.1, you should use the 1.1 docs.

0

精彩评论

暂无评论...
验证码 换一张
取 消