Django 简单联合示例给出:ImportError,无法导入名称 Feed
我正在尝试设置 简单的联合示例 来自 Django 文档,在一个工作项目中。但我收到了 ImportError,即使我确信我已经准确复制了该示例。
这是我在 feeds.py 中的内容:
from django.contrib.syndication.views import Feed
class LatestEntriesFeed(Feed):
# etc
这是我在 urls.py 中的内容:
from election.feeds import LatestEntriesFeed
#... further down, at the appropriate line...
# RSS feed
(r'^feed/$', LatestEntriesFeed()),
但 Django 说它无法从 django.contrib.syndicate.views 导入 Feed 类:
ImportError at /feed/
cannot import name Feed
....feeds.py in <module>
from django.contrib.syndication.views import Feed
有什么想法吗?我很困惑!
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/
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!
, LatestEntriesFeed()),
But Django says it can't import the Feed class from django.contrib.syndication.views:
Any ideas? I'm baffled!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该文档适用于开发版本。为了准备 1.2,提要发生了很大变化。如果您使用的是 1.1,则应使用1.1 文档 。
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.