我有一个带有Django Rest Framework的大型 API REST 项目,我想用Django REST Swagger记录它,但我希望这个Swagger文档只包含我整个项目的一些端点。
这是我urls.py
在项目中设置Swagger的地方:
from rest_framework_swagger.views import get_swagger_view
urlpatterns = i18n_patterns(
path('api-token-auth/', views.obtain_auth_token),
path('', include('FrontEndApp.urls')),
path('admin/', admin.site.urls),
path('api-auth/', include('rest_framework.urls')),
path('docs/',get_swagger_view(title="Intellibook API")),
path('rosetta/', include('rosetta.urls')),
path('general/', include('GeneralApp.urls')),
path('operations_manager/', include('OperationsManagerApp.urls')),
path('payments_manager/', include('PaymentsManagerApp.urls')),
#path('providers_manager/', include('ProvidersManagerApp.urls')),
path('rates_manager/', include('RatesManagerApp.urls')),
path('reports_manager/', include('ReportsManagerApp.urls')),
path('reservations_manager/', include('ReservationsManagerApp.urls')),
path('users_manager/', include('UsersManagerApp.urls')),
path('excursions_manager/', include('ExcursionsManagerApp.urls')),
path('invoices_manager/', include('InvoicesManagerApp.urls'))
)
目前,Swaggerurls.py
发布了整个项目中的所有端点。我想将其设置为ursl.py
仅在项目的应用程序中发布端点。