Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rest framework swagger 'AutoSchema' object has no attribute get_link

Tags:

django

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),
]
like image 488
Mukul Kumar Avatar asked Nov 07 '19 06:11

Mukul Kumar


2 Answers

add below line in settings.py

REST_FRAMEWORK = {'DEFAULT_SCHEMA_CLASS':'rest_framework.schemas.coreapi.AutoSchema' }
like image 83
Prashant Thorat Avatar answered Oct 07 '22 06:10

Prashant Thorat


djagno-rest-swagger is deprecated and suggests to use drf-yasg

like image 4
Shakeel Avatar answered Oct 07 '22 07:10

Shakeel