我正在使用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中导入它。
关于如何解决此错误的任何想法?
答案 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 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
文件。