pip install coreapi
配置settings.py
REST_FRAMEWORK={ 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.AutoSchema', }
全局路由配置docs路由:
from rest_framework.documentation import include_docs_urls from django.conf.urls import url,include urlpatterns = [ url(r'^restapi-docs/',include_docs_urls(title="rest-swagger-api")), ]
请求:
http://localhost:8000/restapi-docs/#student-read
测试创建: