python – 必须安装coreapi才能使用’get_schema_fields()’

前端之家收集整理的这篇文章主要介绍了python – 必须安装coreapi才能使用’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’,…

最佳答案
我认为这是一个错误.它可能会在休息框架3.5.1中修复

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

猜你在找的Python相关文章