我正在使用drf-yasg来记录我的 API,并且我有以下设置,
from django.urls import path
from drf_yasg.views import get_schema_view
public_schema_view = get_schema_view(..., urlconf='public_apis.urls')
private_schema_view = get_schema_view(..., urlconf='private_apis.urls')
urlpatterns = [
path('public/', public_schema_view.with_ui('swagger', cache_timeout=0), name='schema-public'),
path('private/', private_schema_view.with_ui('swagger', cache_timeout=0), name='schema-private'),
]
注意: 和public_schema_view
分别从模块和private_schema_view
中重新生成了两组不同的 URL 。public_apis.urls
private_apis.urls
这里我想要两个basePath
s,
/api/v1/public/
对于public_schema_view
和/api/v1/private/
为了private_schema_view