Note that there are some explanatory texts on larger screens.

plurals
  1. PORedirect Django feed to FeedBurner
    primarykey
    data
    text
    <p>I have an Atom feed set up according to <a href="http://docs.djangoproject.com/en/dev/ref/contrib/syndication/" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/ref/contrib/syndication/</a> which means I have something like</p> <pre><code>(r'^feeds/(?P&lt;url&gt;.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}) </code></pre> <p>in my <code>urls.py</code> and something like</p> <pre><code>class MyFeed(Feed): ... </code></pre> <p>in my <code>feeds.py</code>.</p> <p>I'd like to <a href="http://www.google.com/support/feedburner/bin/answer.py?hl=en&amp;answer=78464" rel="nofollow noreferrer">redirect traffic</a> from this feed to the FeedBurner. I have to do this in Django as there is no mod_rewrite on my server.</p> <hr> <p>I guess I should change <code>urls.py</code> entry to</p> <pre><code>(r'^feeds/(?P&lt;url&gt;.*)/$', 'feeds.redirect', {'feed_dict': feeds}) </code></pre> <p>and supplement <code>feeds.py</code> with</p> <pre><code>from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse def redirect(request, **kwargs): if request.META['HTTP_USER_AGENT'] == 'FeedBurner': view = 'django.contrib.syndication.views.feed' return HttpResponseRedirect(reverse(view, kwargs=kwargs)) else: return HttpResponseRedirect('http://feeds2.feedburner.com/MyFeed') </code></pre> <p>but it doesn't seem to work as I get the following error (you have to change <code>==</code> to <code>!=</code> to see this):</p> <blockquote> <p>NoReverseMatch at /feeds/myfeed/</p> <p>Reverse for '<code>&lt;function feed at 0x16a2430&gt;</code>' with arguments '()' and keyword arguments '{'url': u'myfeed', 'feed_dict': {'myfeed': <code>&lt;class 'feeds.MyFeed'&gt;</code>}}' not found.</p> </blockquote> <p>How can this be solved?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload