安装模块
pip install coreapi
需要去settings配置
REST_FRAMEWORK = {
...
"DEFAULT_AUTHENTICATION_CLASSES": [],
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema'
}
在总路由加
from rest_framework.documentation import include_docs_urls
urlpatterns = [
...
url('docs/', include_docs_urls(title='本项目的接口文档')),
]
在浏览器访问
http://127.0.0.1:8000/docs/