到目前为止,我知道django-rest-swagger从 v0.1.10 开始支持 Markdown 语法中的文档字符串。但是当我尝试查看文档时,它显示为纯文本,而不是解析并将其转换为 HTML 代码。
我在用着:
Django==1.5
Markdown==2.3.1
djangorestframework==2.3.10
django-rest-swagger==0.1.11
SWAGGER_SETTINGS = {
"exclude_namespaces": [], # List URL namespaces to ignore
"api_version": '0.1', # Specify your API's version
"api_path": "", # Specify the path to your API not a root level
"enabled_methods": [ # Specify which methods to enable in Swagger UI
'get',
'post',
'put',
'patch',
'delete'
],
"api_key": '', # An API key
"is_authenticated": True, # Set to True to enforce user authentication,
"is_superuser": False, # Set to True to enforce admin only access
}
API示例代码基于函数的视图:
@api_view(['POST'])
def dummy(request):
'''
Lorem ipsum `dolor` sit amet, consectetur adipiscing elit. Etiam sodales lacus at _nulla_ fringilla fringilla.
### Consectetur adipiscing:
* __dummy_var__: Nunc ut erat justo. Duis turpis augue, posuere a ornare sed,
* another: Vestibulum suscipit congue neque sed faucibus.
* `code`: Cras sit amet ullamcorper ipsum.
'''
pass
当直接浏览 API 时,描述被正确翻译/呈现。
我错过了什么吗?