简体   繁体   English

Django:使用“rest_framework_docs”时“无法导入名称import_string”

[英]Django: "cannot import name import_string" while using "rest_framework_docs"

I installed drfdocs by following the steps as mentioned here .我按照这里提到的步骤安装了drfdocs But I am getting cannot import name import_string .但我cannot import name import_string

Below is the stacktrace:以下是堆栈跟踪:

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

I am using Django 1.6.5 and django-rest-framework-docs==0.1.7我正在使用Django 1.6.5django-rest-framework-docs==0.1.7

Below is the list of pip packages installed on my system:以下是我系统上安装的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

I am sure it is due to any conflict between package version.我确定这是由于包版本之间的任何冲突。 Any help will be appreciated.任何帮助将不胜感激。

It was due to the conflict in the version of drfdocs with django-rest-framework .这是由于drfdocs版本与django-rest-framework的冲突。 Downgrading my version from drfdocs==0.0.11 to drfdocs==0.0.6 fixed the issue.将我的版本从drfdocs==0.0.11降级到drfdocs==0.0.6解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM