【问题标题】:Django: "cannot import name import_string" while using "rest_framework_docs"Django:使用“rest_framework_docs”时“无法导入名称import_string”
【发布时间】:2017-01-25 06:53:10
【问题描述】:

我按照here 中提到的步骤安装了drfdocs。但我收到了cannot import name import_string

下面是堆栈跟踪:

ImportError at /
cannot import name import_string
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 1.6.5
Exception Type: ImportError
Exception Value:    
cannot import name import_string
Exception Location: /usr/local/lib/python2.7/dist-packages/rest_framework_docs/api_docs.py in <module>, line 4
Python Executable:  /usr/bin/python

我正在使用Django 1.6.5django-rest-framework-docs==0.1.7

以下是我系统上安装的pip packages 列表:

moin@moin-pc:~/workspace/my_project$ pip freeze
adium-theme-ubuntu==0.3.4
boto==2.42.0
coreapi==2.0.0
dateutils==0.6.6
Django==1.6.5
django-cors-headers==1.1.0
django-countries==4.0
django-debug-toolbar==1.5
django-rest-framework-docs==0.1.7
django-rest-swagger==2.0.5
django-storages==1.5.1
django-tastypie==0.13.3
django-tastypie-swagger==0.1.4
djangorestframework==2.3.13
drfdocs==0.0.11
itypes==1.1.0
jsonpickle==0.9.3
mysqlclient==1.3.7
openapi-codec==1.0.0
Pillow==3.3.1
psycopg2==2.6.2
pygeocoder==1.2.5
python-dateutil==2.5.3
python-mimeparse==1.5.2
pytz==2016.6.1
PyYAML==3.12
requests==2.11.1
simplejson==3.8.2
six==1.10.0
sqlparse==0.2.1
ua-parser==0.7.1
unity-lens-photos==1.0
uritemplate==3.0.0
user-agents==1.0.1

我确定这是由于软件包版本之间的任何冲突。任何帮助将不胜感激。

【问题讨论】:

    标签: python django python-2.7 django-rest-framework django-1.6


    【解决方案1】:

    这是由于drfdocsdjango-rest-framework 的版本冲突。将我的版本从 drfdocs==0.0.11 降级到 drfdocs==0.0.6 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2011-07-11
      • 2015-03-01
      • 2011-12-27
      • 2018-05-29
      • 2014-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多