'rest framework swagger 'AutoSchema' object has no attribute get_link
I am trying to browse the api documentation of rest framework swagger. but getting error AttributeError: 'AutoSchema' object has no attribute 'get_link
I have used django rest framework swagger. but not able to browse the documentation.
from django.contrib import admin
from django.urls import path, include
from rest_framework_swagger.views import get_swagger_view
schema_view = get_swagger_view(title='API')
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('auth.urls')),
path('docs/', schema_view),
]
Solution 1:[1]
djagno-rest-swagger is deprecated and suggests to use drf-yasg
Solution 2:[2]
use drf-yasg it is more useful than djagno-rest-swagger
Solution 3:[3]
When I add this to my seetings.py, works fine
REST_FRAMEWORK = {
...
'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema',
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shakeel |
| Solution 2 | EsseTi |
| Solution 3 | Abdulrakhmon Mukhitdinov |
