安裝coreapi
修改caseplatform\settings.py
REST_FRAMEWORK = {
# ...其余代码省略
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
}
修改caseplatform\usls.py
from django.contrib import admin
from django.urls import path, include
from rest_framework_jwt.views import obtain_jwt_token
from rest_framework.documentation import include_docs_urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('project.urls')),
path('login/', obtain_jwt_token),
path('api/', include_docs_urls(title='接口文档')),
]
访问接口文档
浏览器访问http://127.0.0.1:8001/api/
如果想要测试接口的话,直接点击Interact即可