Can't use swagger in Django 4.0?

194 views
Skip to first unread message

Emmanuel Lee

unread,
Mar 4, 2022, 9:04:46 AM3/4/22
to Django users

hi everyone,

After installing Django 4.0 and configuring swagger, 'TypeError: 'set' object is not reversible' occurs. Is it possible that Django 4.0 can't use swagger?

error image 
z7jfF.png


Sherif Adigun

unread,
Mar 5, 2022, 1:25:50 AM3/5/22
to Django users
You may need to show your urls.py to see what you are doing.

Emmanuel Lee

unread,
Mar 6, 2022, 2:41:59 AM3/6/22
to Django users
Thanks for answering my question.  Below is my urls.py
----------------------------------------------------------

from django.urls import path, include, re_path

from drf_yasg.views import get_schema_view

from drf_yasg import openapi

from django.conf import settings

from rest_framework.permissions import AllowAny

from rest_framework import routers, permissions



schema_view = get_schema_view(

    openapi.Info(

        title="project Title", 

        default_version='v1',

        description="",

        terms_of_service="https://www.google.com/policies/terms/",

        contact=openapi.Contact(email="a...@a.com"),

        license=openapi.License(name=""),

    ),

    validators=['flex'],

    public=True,

    permission_classes=(AllowAny,)

)



urlpatterns = [

    path(r'swagger(?P<format>\.json|\.yaml)', schema_view.without_ui(cache_timeout=0), name='schema-json'),

    path(r'swagger', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),

    path(r'redoc', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc-v1'),

    # django app

   

]

2022년 3월 5일 토요일 오후 3시 25분 50초 UTC+9에 adigun...@gmail.com님이 작성:

Emmanuel Lee

unread,
Mar 7, 2022, 12:09:05 AM3/7/22
to Django users
Self answer: After commenting out the urls in urls.py of the app in question, it worked normally.

2022년 3월 6일 일요일 오후 4시 41분 59초 UTC+9에 Emmanuel Lee님이 작성:
Reply all
Reply to author
Forward
0 new messages