Python 阅读RSS提要并在Django模板| feedparser中显示
请参阅本博客: 我想为我的应用程序获取RSS源。上面的博客是wordpress博客 我正在使用Python 阅读RSS提要并在Django模板| feedparser中显示,python,django,rss,django-templates,feedparser,Python,Django,Rss,Django Templates,Feedparser,请参阅本博客: 我想为我的应用程序获取RSS源。上面的博客是wordpress博客 我正在使用feedparser import feedparser feeds = feedparser.parse('http://johnsmallman.wordpress.com/author/johnsmallman/feed/') 现在feed['feed']['title']Outputsu“Johnsmallman's Blog\xbb John Smallman” 我的问题是我如何在我的应用程
feedparser
import feedparser
feeds = feedparser.parse('http://johnsmallman.wordpress.com/author/johnsmallman/feed/')
现在feed['feed']['title']
Outputsu“Johnsmallman's Blog\xbb John Smallman”
我的问题是我如何在我的应用程序中准确地呈现这一点。假设这个博客包含100篇文章。所以我想循环并获取所有数据
没有直接的方法吗?任何预定义的库或方法
我经常在谷歌上搜索,但过得很艰难
我基本上是想把它呈现给Django模板。所以我真的会朝着它看
需要指导:)如果您将
提要添加到模板上下文中,您应该能够在模板中循环使用它:
<ul>
{% for entry in feeds.entries %}
<li><a href="{{entry.link}}">{{entry.title}}</a></li>
{% endfor %}
</ul>
{feeds.entries%}
{%endfor%}
谢谢!使用Python3.6在Django 2.0中工作