drf-yasg只能用於drf
去看官方文件
2 coreapi
pip install coreapi
2.1 配置路由
from rest_framework.documentation import include_docs_urls
urlpatterns = [
...
path('docs/', include_docs_urls(title='站點頁面標題'))
]
2.2 drf配置
#AttributeError: 'AutoSchema' object has no attribute 'get_link'
REST_FRAMEWORK = {
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
# 新版drf schema_class預設用的是rest_framework.schemas.openapi.AutoSchema
}