Django: RSS made stupidly simple

by Jeremy Jones

I'm creating yet another website in Django, mostly for fun. One of the things I wanted this website to have was an RSS feed. I glanced at the documentation for generating a feed from Django and was initally put off because it looked a little cumbersome. I then began investigating my other options, like generating the feed manually, and decided to give the Django syndication doc a fuller read. I'm very glad that I did. The reason that Django's RSS generation looked cumbersome at first glance is because it is featureful, flexible, and has every option you will probably need.

In order to create an RSS feed, all I needed to do was create a "feeds" dictionary in my url.conf:

feeds = {
'articles': ArticlesFeed,
'blog': BlogFeed,
'podcasts': PodcastFeed,

a URL pattern:

urlpatterns = patterns('',
##lot of URL configuration omitted here
(r'^feeds/(?P.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),

and a few Feed objects. Here is an example of one:

class BlogFeed(Feed):
title = "Blog Title"
link = "/blog/"
description = "My random thoughts and musings on a variety of subjects."
def items(self):
return get_items("blog")

And everything just works. I tested my feeds with Blam and Sage and they work just fine. I also created a feed with enclosures and both iPodder and a custom podcast grabber I created had no problems with the feed. I can't imagine this being easier.


Adrian Holovaty
2006-06-07 08:59:41
Sweet! I'm glad you gave the docs a second chance. :) We'd welcome any suggestions on making the docs easier. Maybe a "Quick example" section at the very top?
James Bennett
2006-06-07 11:45:39
Yeah, the only real "gotcha" in the feeds system is that to generate an Atom feed instead of RSS (which is the default) you have to make sure you define all the attributes for your feed that the Atom spec requires.
2006-06-12 00:08:05

Django rules! I like it very much and I wish all the best for the developers!

Mike LeValle
2006-07-07 13:19:54
Thanks for your informative Django postings. By the way, who are you using to host your Django site? Thanks.
Jeremy Jones
2006-07-10 06:07:19
Hi Mike,

I'm currently using DreamHost. I had a few hiccups with them, but once I figured out how fastcgi runs over there, it made my life much easier. It's really hard to beat the package they have put together, two of the best features being about 1TB a month transfer and shell access.

2006-11-01 12:46:57
Nice to see another dreamhoster using django, Jeremy!
2008-03-15 00:23:45
Yes, an example on the top should help nobs like me. Anyway time for me to give rss an chance.

Little to do for my holidays :)

see you .. in the net