小编Sau*_*ena的帖子

如何使用sphinx生成python文档时保留换行符

我正在使用Sphinx为python项目生成文档.输出html不保留docstring中存在的换行符.例:

def testMethod(arg1,arg2):
    """
    This is a test method

    Arguments:
    arg1: arg1 description
    arg2: arg2 description

    Returns:
    None
    """
    print "I am a test method"
Run Code Online (Sandbox Code Playgroud)

狮身人面像O/P:

TestModule.testMethod(arg1, arg2)

This is a test method

Arguments: arg1: arg1 description arg2: arg2 description

Returns: None
Run Code Online (Sandbox Code Playgroud)

知道怎么解决吗?

python python-sphinx

46
推荐指数
5
解决办法
3万
查看次数

尝试在浏览器中访问 swagger api 时如何禁用“Django 登录”页面?

当我尝试访问生成的 swagger 文档时,我得到一个空白页面,其中只有一个“Django Login”链接。我正在使用 drf_yasg 库来呈现 swagger 文档。

生成 swagger 文档的代码与 swagger 文档中提到的类似。

   schema_view = get_schema_view(
   openapi.Info(
      title="Snippets API",
      default_version='v1',
      description="Test description",
      terms_of_service="https://www.google.com/policies/terms/",
      contact=openapi.Contact(email="contact@snippets.local"),
      license=openapi.License(name="BSD License"),
   ),
   public=True,
   permission_classes=(permissions.AllowAny,),
)
Run Code Online (Sandbox Code Playgroud)

django swagger drf-yasg

7
推荐指数
1
解决办法
7962
查看次数

标签 统计

django ×1

drf-yasg ×1

python ×1

python-sphinx ×1

swagger ×1