Blog available for sell
This blog is available for sale. Please 'contact us' if interested.
Advertise with us
seo django feeds   0   8252
How to generate ATOM/RSS feed for Django website

In previous articles, we learned how to create a sitemap for the Django website. A valid sitemap increases your website's search engine ranking. Hence good for search engine optimization. 

Similarly, adding a robot.txt file is good for your website. It tells crawlers, which page to crawl and which page not to crawl for indexing.

In this article, we will see how to generate RSS feed on your Django website. 

The RSS feed help to keep up readers with their favorite blogs, news sites, and other websites. RSS allows the content and new updates to come to the reader. Generally, you use RSS to syndicate or subscribe to the feed of a website, blog or almost any media content that is updated online

Create a file in your app directory, parallel to file and name it Paste the below code in it. 

In the below sample example, we are fetching posts/articles from the database of We have implemented four methods, item, item_title, item_description and item_link. The code has been updated with comments.

class LatestEntriesFeed(Feed):
title = " New article for Python programmers every week"
link = "/feed/"
description = "Updates on changes and additions to python articles on"
# return 10 recently created/updated posts
def items(self):
return get_recent_updated_posts(number_of_posts=10)

def item_title(self, item):
return item.title
# return a short description of article
def item_description(self, item):
return item.description
# create and return the article URL
def item_link(self, item):
return reverse('appname:index', args=(item.post_id,))

Now in your project's file (not in any app's file) add below code.

from appname.feeds import LatestEntriesFeed()

# add feeds path
urlpatterns += [
path(r'feed/', LatestEntriesFeed()),

Restart/Reload your Django app and go to or localhost:8000/feed/.

You can validate if RSS feed generated is valid or not.

seo django feeds   0   8252
0 comments on 'How To Generate Atom/Rss Feed For Django Website'

Related Articles:
Creating a bar chart in Django Application
Minimal example of how to create a bar chart or pie chart in Django application using Charts.js. Drawing Analytics charts in Django application. Using charts and graphs to make your Django application visually appealing. Creating Dashboards using Charts.js in Django to convey the information more visually....
Django application to automate the WhatsApp messaging
Django application with REST API endpoints to automate the WhatsApp messaging. Automating WhatsApp web using selenium to send messages. Using selenium to automate whatsapp messaging. Sending bulk messages via whatsapp using automation. Source code Django application Whatsapp Automation...
Python Snippets - A mini project  built using Django - Github Repository made public
mini project, python snippet sharing website, Django project free, Final year project free, Python Django project free,...
Django vs Node.js: Which One Is Better for Web Development?
Benefits of using Django and Node.js, Django vs Node.js: Which One Is Better for Web Development?, Basic features of Django and Node.js, Drawbacks of using Django and Node.js...
DigitalOcean Referral Badge

© 2022-2023 Python Circle   Contact   Sponsor   Archive   Sitemap