- 我們需要api文檔來敘述api的內(nèi)容
- 我們會經(jīng)常做出改動
- 我們需要一個api文檔來幫助檢測功能
coreapi
- 好看的api文檔
- pip install coreapi
綱要文檔
# urls.py
from rest_framework.schemas import get_schema_view
urlpattern = [
url(r'^schema/', get_schema_view(title='文檔-API'))
]
改進(jìn)為:API文檔
from rest_framework.documentation import include_docs_urls
urlpattren = [
url(r'docs/', include_docs_urls(title='醫(yī)院-API'))
]
Swagger
- 多編程語言通用的API文檔
- pip install django-rest-swagger
# setting.py
INSTALLED_APPS = [
...
'rest_framework_swagger'
]
# urls.py
from rest_framework_swagger.views import get_swagger_view
urlpatterns = [
url(r'docs/', get_swagger_view(title='病人-API'))
]
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者