Reputation: 5402
What I'd like to do is extract the headline and URL out of the feed data from my wordpress blog, and display it as a link within my Django template.
I found this example
But it doesn't prove useful in Django. (I'm a n00b). So I was wondering if anyone had any suggestions on how I might grab the feeb and place it into a Django application?
<a href="link-to-feed">Title of blog post</a>
Thank you for your help in advance.
Upvotes: 2
Views: 674
Reputation: 955
I know this thread is old, but I found this to be really helpful too: http://geekscrap.com/2010/02/integrate-wordpress-and-django/
I'm using option 2, the xmlrpc. here's the github page for examples
https://github.com/maxcutler/python-wordpress-xmlrpc/blob/master/docs/examples/posts.rst
this pulls right from the rss feed, just as the other answer. I dont know how performant this solution is vs the other one though, sorry.
Upvotes: 0
Reputation: 3373
Basically you need to parse your wordpress feed in your Django View, then send that rendered data to your template.
Good Resource also feedparser specs: http://pythonhosted.org/feedparser/
Do some research in parsing XML with Python in your Django view
1. Hit the Wordpress Feed URL in view.py
2. Parse the resulting XML nodes (or feedparser I think)
3. Extract needed data
4. Send data to your django template from the view
Upvotes: 3