2016-09-17 42 views
1

我按照here提到的步驟安裝了drfdocs。但我得到cannot import name import_stringDjango:在使用「rest_framework_docs」時「無法導入名稱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名單:

[email protected]:~/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 

我相信這是因爲包版本之間的任何衝突。任何幫助將不勝感激。

回答

1

這是由於版本drfdocsdjango-rest-framework的衝突。將我的版本從drfdocs==0.0.11降級到drfdocs==0.0.6解決了問題。