1、pip install coreapi
2、settings配置
REST_FRAMEWORK = {
‘DEFAULT_SCHEMA_CLASS’: ‘rest_framework.schemas.coreapi.AutoSchema’,
}
3、根路由urls.py
from rest_framework.documentation import include_docs_urls # 接口文档
urlpatterns = [
path(‘docs/’, include_docs_urls(title=‘使用coreapi生成的接口文档’)),
]
4、在视图(views.py)下,每个类视图或函数视图使用三引号写文档
5、浏览器输入:http://127.0.0.1:8000/docs/django2.2 RES框架接口生成文档

相关文章:

  • 2021-07-04
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2021-12-06
  • 2021-09-14
  • 2022-12-23
猜你喜欢
  • 2021-09-21
  • 2021-12-13
  • 2022-12-23
  • 2022-01-14
  • 2021-09-05
  • 2021-08-08
  • 2022-01-21
相关资源
相似解决方案