【问题标题】:Django ViewDoesNotExist error after installing photologue安装 photologue 后出现 Django ViewDoesNotExist 错误
【发布时间】:2013-04-13 04:52:49
【问题描述】:

我正在使用 Django 1.5.1。一切都很好。但是一旦我通过 pip 安装了 django-photologue,当我访问管理 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。

知道如何解决这个错误吗?

【问题讨论】:

    标签: django django-views photologue


    【解决方案1】:

    替换目录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"
    

    像这样:)

    或阅读:

    【讨论】:

    【解决方案2】:

    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 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-09
      • 2017-09-09
      • 1970-01-01
      • 1970-01-01
      • 2011-07-02
      相关资源
      最近更新 更多