安装photologue后出现Django ViewDoesNotExist错误

时间:2013-04-19 17:51:54

标签: django django-views photologue

我正在使用Django 1.5.1。一切都很好。但是当我通过pip安装django-photologue时,当我访问admin url时遇到此错误:

> **ViewDoesNotExist at /admin/**  
Could not import django.views.generic.list_detail.object_list. Parent module django.views.generic.list_detail does not exist.  
Request Method: GET  
Request URL:    http://localhost:8000/admin/  
Django Version: 1.5.1  
Exception Type: ViewDoesNotExist  
Exception Value:      
Could not import django.views.generic.list_detail.object_list. Parent module   django.views.generic.list_detail does not exist.  
Exception Location: /usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py in get_callable, line 104  
Python Executable:  /usr/bin/python  
Python Version: 2.7.3  

当我运行syncdb时,photologue与数据库同步没有任何错误,我可以在shell中导入它。

关于如何解决此错误的任何想法?

2 个答案:

答案 0 :(得分:3)

替换目录urls.py photologue中的文件:

"django.views.generic.date_based" and "django.views.generic.list_detail" on "django.views.generic" 

"object_list" on "list.ListView"
"object_detail" on "detail.DetailView"
"archive_year" on "dates.YearArchiveView"
"archive_month" on "dates.MonthArchiveView"
"archive_day" on "dates.DayArchiveView"
像这样:)

或阅读:

答案 1 :(得分:1)

django-photologue最有可能是为旧版本的Django而构建的。看起来较新版本的Django对通用视图不友好,而更喜欢基于类的视图。

下载Django 1.5.1的新副本会显示以下内容: http://f.cl.ly/items/0k1J261S2J2f3k3C110I/Image%202013.04.20%203%3A44%3A39%20AM.png

Django 1.4.2显示: http://f.cl.ly/items/152J2U050X0z1j1n0v0D/Image%202013.04.20%203%3A46%3A49%20AM.png

简单地说,较新版本的Django 删除了 list_detail文件。