gpt4 book ai didi

python - 如何解决 Django 管理中的 "Could not import django.contrib.syndication.views.feed"错误?

转载 作者:太空狗 更新时间:2023-10-30 00:23:43 25 4
gpt4 key购买 nike

我已经将我的 Django 版本更新到最新的 nightly,我在管理员中收到以下错误;

Could not import django.contrib.syndication.views.feed.  View does not exist in module django.contrib.syndication.views.

I had this error in several views too because, indeed, django.contrib.syndication.views.feed was deprecated and has been removed.
I only had to add a

from django.contrib.syndication.views import Feed

from django.contrib.syndication.feeds import Feed

问题是我在任何地方都找不到对 django.contrib.syndication.views.feed 的任何引用,甚至在 Django 源代码中也找不到,所以我不明白错误是从哪里来的从以及如何解决它。

错误的直接来源是

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/urlresolvers.py in get_callable, line 100

但我在那里也找不到任何东西。

希望有人能帮忙!

最佳答案

user643511建议错误可能在我自己的代码中,而不是 Django。但是她没有指出真正的问题(我理解,因为我没有提供正确的信息)。经过几天的挖掘,我发现我有

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

urls.py 中。相反,我不得不使用

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

注意 views.Feed 中的大写字母 F。

因此,如果有人遇到类似问题,请检查 urls.py。

关于python - 如何解决 Django 管理中的 "Could not import django.contrib.syndication.views.feed"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6642829/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com