必须安装 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()

我安装了以下软件包:

编辑:

已安装的应用程序:

我认为这是一个错误。它可能会在 rest framework 3.5.1

中修复

看到这个问题: https://github.com/tomchristie/django-rest-framework/pull/4601#event-831195901

尝试安装 coreapi,这对我有用

pip install coreapi pyyaml