Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

ImportError: No module named generators #126

Open
ju5t opened this issue Feb 10, 2018 · 2 comments
Open

ImportError: No module named generators #126

ju5t opened this issue Feb 10, 2018 · 2 comments

Comments

@ju5t
Copy link

ju5t commented Feb 10, 2018

  • DRF OpenAPI version: 1.3.0
  • DRF version: 3.6.4
  • Python version: 2.7
  • Operating System: Ubuntu 16.04 (Docker) and MacOS

Description

I tried to add drf_openapi to an existing project.

What I Did

I have added drf-openapi==1.3.0 to my requirements.txt and installed it. I've added 'drf_openapi', to INSTALLED_APPS and url(r'^/docs/', include('drf_openapi.urls')) to the urlpatterns.

When starting the Docker image (or just runserver locally) this results in the following error:

 File "/usr/local/lib/python2.7/dist-packages/drf_openapi/views.py", line 7, in <module>
   from drf_openapi.entities import OpenApiSchemaGenerator
 File "/usr/local/lib/python2.7/dist-packages/drf_openapi/entities.py", line 16, in <module>
   from rest_framework.schemas.generators import insert_into, distribute_links, LinkNode
ImportError: No module named generators

If it makes any difference our DEFAULT_VERSIONING_CLASS is set to AcceptHeaderVersioning.

REST_FRAMEWORK = {
    'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.AcceptHeaderVersioning',
    'DEFAULT_VERSION': API_VERSION,
}

Obviously I'm missing something out in the open here. The default documentation in DRF does work for us.

@ju5t
Copy link
Author

ju5t commented Feb 10, 2018

Apparently DRF 3.6.4 isn't supported anymore. I've upgraded to 3.7.7 and that starts the application but fails to render any pages. From the looks of it because AcceptHeaderVersioning is not playing along.

NoReverseMatch: Reverse for 'api_schema' with keyword arguments '{u'version': u'1.0.0'}' not found. 1 pattern(s) tried: ['docs/schema/$']

@volodchenkov
Copy link

I have the same problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants