django-rest_framework接口文档自动生成

只针对用到序列化和返序列化

一般还是用第三方yipi

一.安装依赖

pip3 install coreapi

二.设置

setting.py

INSTALLED_APPS = [
.....
'rest_framework',
]
.....
REST_FRAMEWORK = {
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema',
}

三.路由设置

from django.conf.urls import url
from rest_framework.documentation import include_docs_urls
urlpatterns = [
.....
url(r'docs/', include_docs_urls(title='接口文档'))
]

四.展示效果内容

django接口文档自动生成-LMLPHP

04-27 07:04