首页 > 解决方案 > 记录 Django Rest 框架 API

问题描述

为 django rest 框架应用程序寻找自我描述 api

我们正在使用 Django 2 和 Django Rest Framework 3.7.3 我们正在寻找基于视图文档字符串或元数据的 api 我尝试过 drf docs 和 drf auto docs 但似乎不支持我们的应用程序有人提到 pydocs ,但不要认为这会起作用我们更糟糕的情况是我认为使用 Sphinx

我们想要一个理想地给出示例的 api

示例请求:

GET /tests HTTP/1.1

示例响应:

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "name": "test1",

    },
    {
        "name": "test2",

    }
]

状态码:

200 OK – List of a tests.

标签: pythondjangorestdjango-rest-frameworkdocumentation

解决方案


您可以尝试支持生成 redoc 或 swagger 文档的drf-yasg 。


推荐阅读