restframework 生成接口文档

pip  install coreapi 

 

配置settings.py

REST_FRAMEWORK={

    'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema',
}

 

全局路由配置docs路由:

from rest_framework.documentation import include_docs_urls
from django.conf.urls import url,include


urlpatterns = [
    url(r'^restapi-docs/',include_docs_urls(title="rest-swagger-api")),
  
]

 

请求:

http://localhost:8000/restapi-docs/#student-read

测试创建:

 

posted @ 2020-10-25 16:47  不带R的墨菲特  阅读(199)  评论(0编辑  收藏  举报