1

Have updated the django-rest-framework to last version, why there still have the error?

ImportError: No module named 'django.core.urlresolvers'

From the post:

https://stackoverflow.com/a/47330759/7646621

I have update the djangorestframework to the version 3.8.2.

But the issue still exists.

 File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/rest_framework_docs/urls.py", line 2, in <module>
    from rest_framework_docs.views import DRFDocsView
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/rest_framework_docs/views.py", line 3, in <module>
    from rest_framework_docs.api_docs import ApiDocumentation
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/rest_framework_docs/api_docs.py", line 3, in <module>
    from django.core.urlresolvers import RegexURLResolver, RegexURLPattern
ImportError: No module named 'django.core.urlresolvers'

my Django version is Version: 2.0.6.

qg_java_17137
  • 3,310
  • 10
  • 41
  • 84

2 Answers2

1

You need to upgrade rest_framework_docs as well.

Linovia
  • 19,812
  • 4
  • 47
  • 48
  • I don't know what package you did install. However, the stack trace points to some rest_framework_docs namespace which is *not* part of the regular Django REST framework which means you have installed an incompatible 3rd party. – Linovia Jun 22 '18 at 08:45
  • I updated, but this is the last version of `drfdocs`. seems some people still have this issue on GitHub.https://github.com/manosim/django-rest-framework-docs/issues/175 – qg_java_17137 Jun 22 '18 at 08:56
1

From the drfdocs https://www.drfdocs.com/installation/:

you can upgrade it by:

pip install --upgrade drfdocs
aircraft
  • 25,146
  • 28
  • 91
  • 166