开发者

how to make RSS feeds where the /rss/ is at the end of the URL, not at the beginning?

http://docs.djangoproject.com/en/dev/ref/contrib/syndication/ describ开发者_开发知识库es the way to use the Feeds class, and it works well for me, but it requires the URL to be like http://example.com/rss/feedid/parameters/

I need it to be http://example.com/feedid/parameters/rss/

How to do that?


Since Django's URLs are based on regexes, I think that you can use a rule like this:

(r'^(?P<url>.*)/rss/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),

Though personally, I have never used the Django syndication framework - I just use generic views (or wrappers around generic views) with the content_type option, and generate the RSS/Atom with a template.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜