Generating XML/Feed for your Python Blog

kammo

New Member
I've been trying to add RSS feeds in my blog(webapp2 application - Jinja2 templates), this is what I have:\[code\]class XMLHandler(Handler): def get(self): posts = db.GqlQuery("SELECT * FROM Post WHERE is_draft = FALSE ORDER BY created DESC") self.render("xmltemplate.xml", posts=posts, mimetype='application/xml')\[/code\]xmltemplate.xml looks like this: \[code\]<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"> <channel> <title>Blag</title> <link>http://www.blagonudacity.appspot.com/</link> <description>Yet Another Blag</description> {%for post in posts %} <entry> <title>{{post.subject}}></title> <link href="http://www.blagonudacity.appspot.com/post/{{ post.key().id()}}" rel="alternate" /> <updated>{{post.created}}</updated> <author><name>Prakhar Srivastav</name></author> <summary type="html"> {{ post.content }} </summary> </entry> {%endfor%} </channel></feed>\[/code\]What i'm getting in my browser when I migrate to the relevant page \[code\]/feeds/all.atom.xml\[/code\] is just a html page with the markup. It doesn't look like how XML pages look in browser. What am I doing wrong here? Here is the demo
 
Back
Top