必须安装 coreapi 才能使用 'get_schema_fields()'
coreapi must be installed to use 'get_schema_fields()'
所以我安装了django-rest-swagger,如django rest documentation所示。
然后
from django.conf.urls import url
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='Pastebin API')
urlpatterns = [
url(r'^$', schema_view)
]
我不断收到以下错误,
File ".../local/lib/python2.7/site-packages/django_filters/rest_framework/backends.py", line 97, in get_schema_fields
assert compat.coreapi is not None, 'coreapi must be installed to use get_schema_fields()
'
AssertionError: coreapi must be installed to use get_schema_fields()
我安装了以下软件包:
- coreapi==2.0.8
- Django==1.9.6
- django-filter==0.15.3
- django-rest-swagger==2.0.7
- djangorestframework==3.5.0
编辑:
已安装的应用程序:
- 'rest_framework',
- 'rest_framework_swagger', ...
我认为这是一个错误。它可能会在 rest framework 3.5.1
中修复
看到这个问题:
https://github.com/tomchristie/django-rest-framework/pull/4601#event-831195901
尝试安装 coreapi,这对我有用
pip install coreapi pyyaml
所以我安装了django-rest-swagger,如django rest documentation所示。
然后
from django.conf.urls import url
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='Pastebin API')
urlpatterns = [
url(r'^$', schema_view)
]
我不断收到以下错误,
File ".../local/lib/python2.7/site-packages/django_filters/rest_framework/backends.py", line 97, in get_schema_fields assert compat.coreapi is not None, 'coreapi must be installed to use
get_schema_fields()
' AssertionError: coreapi must be installed to useget_schema_fields()
我安装了以下软件包:
- coreapi==2.0.8
- Django==1.9.6
- django-filter==0.15.3
- django-rest-swagger==2.0.7
- djangorestframework==3.5.0
编辑:
已安装的应用程序:
- 'rest_framework',
- 'rest_framework_swagger', ...
我认为这是一个错误。它可能会在 rest framework 3.5.1
中修复看到这个问题: https://github.com/tomchristie/django-rest-framework/pull/4601#event-831195901
尝试安装 coreapi,这对我有用
pip install coreapi pyyaml