RSS 配置信息:

一、 配置Feed
在应用目录下新建feed.py

在feed 文件中写入

from django.contrib.syndication.views import Feed
from .models import Artice
from django.shortcuts import reverse
class BlogEeed(Feed):
    title = 'zjw的博客'
    description = '学习内容'
    link = '/'
def items(self):
    return Artice.objects.all()

def item_title(self, item):
    return item.title

def item_description(self, item):
    return item.body[:30]

def item_link(self, item):
    return reverse('blog:single', args=(item.id,))

二、 创建路由

from django.conf.urls import url
from . import views
from . import feed
app_name= 'blog'

urlpatterns = [
    url('^rss/$', feed.BlogEeed(), name='rss'),
]

三 添加RSS超级链接 {% url ‘blog:rss’ %}