In below code am not able to generate schema for 2 endpoints admin/ and payslip/
urlpatterns = [ # YOUR PATTERNS path('admin/', admin.site.urls),, path('payslip/',include('payslip.urls')) path('api/schema/', SpectacularAPIView.as_view(), name='schema'), # Optional UI: path('api/schema/swagger-ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'), path('api/schema/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'), ]
The Django admin is not built from REST API endpoints. The admin is made of a lot of regular Django templated html views. Views discovered by drf-spectacular
must be derived from either APIView
or GenericAPIView
in one way or another. These are the fundamental base classes of rest_framework
.
Can't really attest to what payslip
is made of but the same rules apply there.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.