Likewise, including a robot.txt file benefits 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 create RSS eat your Django website.
The RSS feed help to keep up readers with their favorite blogs, news sites, and other websites. RSS enables the content and brand-new updates to come to the reader. Generally, you use RSS to syndicate or sign up for the feed of a website, blog site or almost any media content that is updated online
Create a file in your app directory, parallel to urls.py file and name it
feeds.py Paste the listed below code in it.
In the below sample example, we are bring posts/articles from the database of pythoncircle.com. We have actually executed four techniques,
item_link The code has been updated with comments.
class LatestEntriesFeed( Feed):
title = " PythonCircle.com: New post for Python developers each week"
link = "/ feed/"
description = " Updates on changes and additions to python short articles on pythoncircle.com."
# return 10 recently created/updated posts
def items( self):
return get_recent_updated_posts( number_of_posts =-LRB- ***********)10)
def item_title( self, item):
# return a short description of short article
def item_description( self, item):
# develop and return the post URL
def item_link( self, product):
return reverse(' appname: index', args=( item.post _ id,))
Now in your task’s
urls.py file (not in any app’s urls.py file) include listed below code.
from appname.feeds import LatestEntriesFeed(). # add feeds course urlpatterns = [