title: Python django ImportError: cannot import name (unknown location)
body: <p>I am starting to use Django and was able to get Django Rest Framework working. Now, I am trying out Elasticsearch using <a href="https://django-elasticsearch-dsl-drf.readthedocs.io/en/0.18/" rel="nofollow noreferrer">https://django-elasticsearch-dsl-drf.readthedocs.io/en/0.18/</a> and also 
  following <a href="https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/tree/master/examples/simple" rel="nofollow noreferrer">https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/tree/master/examples/simple</a></p>
  
  <p>I followed the examples, built my project along those lines. I am getting the ImportError when I try to start server, could anyone please review and give me pointers on what I may be missing. I am enclosing some details about my environment for reference.</p>
  
  <p>Thanks</p>
  
  <p>Environment:</p>
  
  <pre><code>cmd &gt; pip freeze | find "Django"
  django-cors-headers==3.0.2
  django-elasticsearch-dsl==0.5.1
  django-elasticsearch-dsl-drf==0.18
  django-filter==2.1.0
  django-nine==0.2.2
  djangorestframework==3.9.4
  </code></pre>
  
  <h2>Directory structure</h2>
  
  <pre><code>demosite 
      demosite
          settings.py [INSTALLED_APPS contains my_rest_app, search_indexes]
  
  
  my_rest_app   [which works with http://localhost:8000/my_rest_app/]        
  
  search_indexes
      viewsets
          publisher.py  [see below]
      urls.py [see below]
      documents
          publisher.py [see below]
  
  
  
  
  search_indexes/url.py
  ---------------------
  from django.conf.urls import url, include
  from rest_framework.routers import DefaultRouter
  from search_indexes.viewsets import PublisherDocumentViewSet
  
  urlpatterns = [
      url(r'^', include(router.urls)),
  ]
  
  # **********************************************************
  # *********************** Publishers ***********************
  # **********************************************************
  router.register(
      r'publishers',
      PublisherDocumentViewSet,
      basename='publisherdocument'
  )
  
  
  search_indexes/viewsets/publisher.py
  ------------------------------------
  from django_elasticsearch_dsl_drf.pagination import LimitOffsetPagination
  from django_elasticsearch_dsl_drf.viewsets import DocumentViewSet
  
  from ..documents import PublisherDocument
  from ..serializers import PublisherDocumentSerializer
  __all__ = (
      'PublisherDocumentViewSet',
  )
  
  class PublisherDocumentViewSet(DocumentViewSet):
      """The PublisherDocument view."""
  
      document = PublisherDocument
      serializer_class = PublisherDocumentSerializer
  
  
  search_indexes/documents/publisher.py
  --------------------------------------
  from my_rest_app.models import Publisher
  
  __all__ = ('PublisherDocument',)
  
  INDEX = Index(settings.ELASTICSEARCH_INDEX_NAMES[__name__])
  
  # See Elasticsearch Indices API reference for available settings
  INDEX.settings(
      number_of_shards=1,
      number_of_replicas=1,
      blocks={'read_only_allow_delete': False},
      # read_only_allow_delete=False
  )
  
  
  @INDEX.doc_type
  class PublisherDocument(DocType):
      """Publisher Elasticsearch document."""
  
  
  search_indexes/serializers/publisher.py
  ---------------------------------------
  from ..documents import PublisherDocument
  
  __all__ = (
      'PublisherDocumentSerializer',
      'PublisherDocumentSimpleSerializer',
  )
  
  
  class PublisherDocumentSerializer(serializers.Serializer):
  and
  class PublisherDocumentSimpleSerializer(DocumentSerializer):
      """Serializer for Publisher document."""
  
  ---------demosite/urls.py
  ---------demosite/urls.py    
  from django.contrib import admin
  from django.urls import include, path
  from django.views.generic import RedirectView
  #from search_indexes import urls as search_index_urls
  
  
  urlpatterns = [
      path('my_rest_app/', include('my_rest_app.urls')),
  
      path('search_indexes/', include('search_indexes.urls')),
  
      path('admin/', admin.site.urls),
      path('', RedirectView.as_view(url='/my_rest_app/', permanent=True)),
  
      #path('', RedirectView.as_view(url='/search_indexes/', permanent=True)),
  
  ]
  
  
  --------- stack trace -------
  
    File "C:\apps\Python37-32\lib\site-packages\django\urls\resolvers.py", line 572, in urlconf_module
      return import_module(self.urlconf_name)
    File "C:\apps\Python37-32\lib\importlib\__init__.py", line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "&lt;frozen importlib._bootstrap&gt;", line 1006, in _gcd_import
    File "&lt;frozen importlib._bootstrap&gt;", line 983, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 967, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 677, in _load_unlocked
    File "&lt;frozen importlib._bootstrap_external&gt;", line 728, in exec_module
    File "&lt;frozen importlib._bootstrap&gt;", line 219, in _call_with_frames_removed
    File "C:\demosite\demosite\urls.py", line 25, in &lt;module&gt;
      path('search_indexes/', include('search_indexes.urls')),
    File "C:\apps\Python37-32\lib\site-packages\django\urls\conf.py", line 34, in include
      urlconf_module = import_module(urlconf_module)
    File "C:\apps\Python37-32\lib\importlib\__init__.py", line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File "&lt;frozen importlib._bootstrap&gt;", line 1006, in _gcd_import
    File "&lt;frozen importlib._bootstrap&gt;", line 983, in _find_and_load
    File "&lt;frozen importlib._bootstrap&gt;", line 967, in _find_and_load_unlocked
    File "&lt;frozen importlib._bootstrap&gt;", line 677, in _load_unlocked
    File "&lt;frozen importlib._bootstrap_external&gt;", line 728, in exec_module
    File "&lt;frozen importlib._bootstrap&gt;", line 219, in _call_with_frames_removed
    File "C:\demosite\search_indexes\urls.py", line 3, in &lt;module&gt;
      from search_indexes.viewsets import PublisherDocumentViewSet
  ImportError: cannot import name 'PublisherDocumentViewSet' from 'search_indexes.viewsets' (unknown location)
  </code></pre>