我正在使用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)
知道怎么解决吗?
当我尝试访问生成的 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)