- Global configuration
# DRF 全局配置
REST_FRAMEWORK = {
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
}
- In the total routing file urls.py
from rest_framework.documentation import include_docs_urls
urlpatterns = [
path('docs/', include_docs_urls(title="DRF API 文档", description="描述信息")),
]
- Browser visit localhost:8000/docs