Django-rest-framework-docs 方法描述



美好的一天。

我想为我的 API 制作文档。我使用这个库

https://github.com/manosim/django-rest-framework-docs

我需要添加方法的描述,但这意味着不起作用 https://yadi.sk/i/y3hodAvn3TMRJ3

我的代码

def get(self, request):
    """
    description for method
    """

我也试过了

class UserViewSet(ModelViewSet):
    """
    me:
        Return current user.
    update:
        update users
    """
    queryset = User.objects.all()

我做错了什么?

您使用了错误的库。从文档中,您正在使用的库和相关 DRF 库适用于 -

  1. API 端点的文档。
  2. 自动生成的代码示例对于每个可用的 API 客户端库。
  3. 支持 API 交互。

它们不是用来记录您的文档字符串的。为此,请使用python文档库,如sphinx。

相关链接 - http://docs.python-guide.org/en/latest/writing/documentation/

最新更新