myarik / django-rest-elasticsearch

Elasticsearch support for Django REST Framework
Other
192 stars 38 forks source link

ImportError: cannot import name 'AutoSchema' #20

Closed yogeek closed 6 years ago

yogeek commented 6 years ago

Hello,

With the following environment :

django-rest-elasticsearch==0.3.3
django-rest-swagger==2.1.2
djangorestframework==3.6.2
djangorestframework-bulk==0.2.1
elasticsearch==5.5.1
elasticsearch-dsl==5.4.0

I have now the following error when launching Django :

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/var/www/app/apps/spirit/viewsets/__init__.py", line 22, in <module>
    from .elogquery_viewset import ELogQueryViewSet
  File "/var/www/app/apps/spirit/viewsets/elogquery_viewset.py", line 19, in <module>
    from rest_framework_elasticsearch import es_views, es_pagination, es_filters
  File "/usr/local/lib/python3.4/site-packages/rest_framework_elasticsearch/es_views.py", line 6, in <module>
    from .es_mixins import ListElasticMixin
  File "/usr/local/lib/python3.4/site-packages/rest_framework_elasticsearch/es_mixins.py", line 9, in <module>
    from .es_inspector import EsAutoSchema
  File "/usr/local/lib/python3.4/site-packages/rest_framework_elasticsearch/es_inspector.py", line 1, in <module>
    from rest_framework.schemas import AutoSchema
ImportError: cannot import name 'AutoSchema'

The documentation indicates "Django REST Framework 3.5 and above" but it seems that the commit 1097193374b534f302f6cc58322392fdd7563702 added the AutoSchema and this implies the version djangorestframework==3.7.1 minimum

Do you confirm that this package does not work anymore with djangorestframework < 3.7 ? If it is right, the install_requires would have to be updated in setup.py

Thank you

dmvass commented 6 years ago

@yogeek thanks for your issue report, I'm fixed this case. I think that after test cases implementations we could fixed many support bugs.

fiacre commented 6 years ago

I can't even get that error:

from rest_framework.schemas import AutoSchema ModuleNotFoundError: No module named 'rest_framework.schemas'

I am using:

django-rest-elasticsearch==0.3.3 django-rest-framework-mongoengine==3.3.1 djangorestframework==3.3.3

myarik commented 6 years ago

Please upgrade to the version 0.3.4 (django-rest-elasticsearch==0.3.4)