DRF自帶的的文檔生成功能,非常方便。
配置:
from rest_framework.documentation import include_docs_urls
urlpatten=[
……
url(r'docs/', include_docs_urls(title="yitao")),
……
]
在settings.py文件中,需加上
REST_FRAMEWORK = {
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema'
}
進入文檔頁面: