Django esempio simple syndication dà: ImportError, non può importare nome feed
-
25-09-2019 - |
Domanda
Sto cercando di impostare il semplice esempio syndication dalla documentazione Django, in un progetto di lavoro. Ma sto diventando un ImportError, anche se sono sicuro che ho copiato l'esempio esattamente.
Ecco quello che ho in feeds.py:
from django.contrib.syndication.views import Feed
class LatestEntriesFeed(Feed):
# etc
Ed ecco quello che ho nel urls.py:
from election.feeds import LatestEntriesFeed
#... further down, at the appropriate line...
# RSS feed
(r'^feed/$', LatestEntriesFeed()),
Ma Django dice che non può importare la classe di alimentazione da django.contrib.syndication.views:
ImportError at /feed/
cannot import name Feed
....feeds.py in <module>
from django.contrib.syndication.views import Feed
Tutte le idee? Sono sconcertato!
Soluzione
Questa documentazione è per la versione di sviluppo. Feed sono cambiate un bel po 'in preparazione per 1.2. Se stai usando 1.1, è necessario utilizzare 1,1 docs .
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow