参考Core API官网以及drf官网,最终生成的接口文档是以网页的方式呈现的,自动接口文档能生成的是继承自APIView及其子类的视图,具体实现流程如下
2.1 安装Core API库
pip3 install...'LOGIN_URL': 'rest_framework:login',
'LOGOUT_URL': 'rest_framework:logout',
# 控制API列表的显示方式 None...P\.json|\.yaml)$', schema_view.without_ui(cache_timeout=0), name='schema-spec'),
re_path(..., JSON 格式的 API 定义
/swagger.yaml, YAML 格式的 API 定义
/swagger/, 基于原生 swagger-ui 样式的前端页面
/redoc/, 基于 ReDoc...SchemaView.without_ui(cache_timeout, cache_kwargs): 返回无UI的视图函数, 该函数可以返回json/yaml格式的swagger文档
以上两个函数均支持通过