Opened 7 years ago

Last modified 7 years ago

#29418 closed Bug

rss feed returnes 404 — at Initial Version

Reported by: BeshoyFarag Owned by: nobody
Component: contrib.syndication Version: 2.0
Severity: Normal Keywords: 404, rss, atom
Cc: BeshoyFarag Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

this is what my Django rss feed returns

Page not found (404)
Request Method:
GET
Request URL:
http://127.0.0.1:8000/blog/rss
Raised by:
django.views.generic.detail.DetailView
No post found matching the query
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.

my feeds.py

from django.contrib.syndication.views import Feed
from blog.models import Post
from django.utils.feedgenerator import Atom1Feed
from django.utils.html import escape

class RssSiteNewsFeed(Feed):

title = "blog rss "
link = "/blog/rss/"
description = "blog rss and atom feeds ."

def items(self):

return Post.objects.order_by('date')[:10]

def item_title(self, item):

return item.title

def item_description(self, item):

return item.description

def item_link(self, item):

return item.get_absolute_url()

class AtomSiteNewsFeed(RssSiteNewsFeed):

feed_type = Atom1Feed
subtitle = RssSiteNewsFeed.description

my models .py

class Post(models.Model):

title = models.CharField (max_length = 160, null=False)
body = models.TextField( null=False)
date = models.DateTimeField()
author = models.CharField (max_length = 160)
description = models.TextField(max_length = 160)
keywords = models.TextField()
category = models.ForeignKey(Category,on_delete=models.DO_NOTHING)
slug = models.SlugField(max_length = 160,unique=True)
img_url = models.URLField()
short_blog_snippet= models.CharField(max_length = 15)
absolute_url = models.CharField(max_length=400, blank=True, editable=False)

def str(self):


return self.title


def get_absolute_url(self ):


return "/blog/%s" % self.slug

def unicode(self):

return self.title

I do not know what i am doing wrong .

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top