Added drf_yasg in place of django rest swagger
This commit is contained in:
parent
7172ec9f0d
commit
b96c0db896
@ -48,8 +48,14 @@ INSTALLED_APPS = [
|
||||
'corsheaders',
|
||||
'rest_framework_simplejwt.token_blacklist',
|
||||
'django_filters',
|
||||
'rest_framework_swagger',
|
||||
'drf_yasg',
|
||||
]
|
||||
SPECTACULAR_SETTINGS = {
|
||||
'SWAGGER_UI_DIST': 'SIDECAR', # shorthand to use the sidecar instead
|
||||
'SWAGGER_UI_FAVICON_HREF': 'SIDECAR',
|
||||
'REDOC_DIST': 'SIDECAR',
|
||||
# OTHER SETTINGS
|
||||
}
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
|
||||
24
core/urls.py
24
core/urls.py
@ -35,9 +35,25 @@ from qrtr_account.views import (AccountViewSet,
|
||||
TwitterLogin)
|
||||
|
||||
from connection.views import ConnectionViewSet, ConnectionTypeViewSet
|
||||
from rest_framework_swagger.views import get_swagger_view
|
||||
|
||||
schema_view = get_swagger_view(title="Qrtr API")
|
||||
|
||||
from rest_framework import permissions
|
||||
from drf_yasg.views import get_schema_view
|
||||
from drf_yasg import openapi
|
||||
|
||||
|
||||
schema_view = get_schema_view(
|
||||
openapi.Info(
|
||||
title="Qrtr API",
|
||||
default_version='v1',
|
||||
description="",
|
||||
terms_of_service="https://www.google.com/policies/terms/",
|
||||
contact=openapi.Contact(email="contact@snippets.local"),
|
||||
license=openapi.License(name="BSD License"),
|
||||
),
|
||||
public=True,
|
||||
permission_classes=[permissions.AllowAny],
|
||||
)
|
||||
|
||||
router = routers.DefaultRouter()
|
||||
router.register(r'users', UserViewSet)
|
||||
@ -67,7 +83,9 @@ apipatterns = [
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('api/v1/', include(apipatterns), name='api'),
|
||||
path('api/v1/docs', schema_view),
|
||||
# path('api/v1/schema/', SpectacularAPIView.as_view(), name='schema'),
|
||||
path('api/v1/docs', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
|
||||
path('api/v1/schema/redoc/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
|
||||
path('accounts/', include('allauth.urls')),
|
||||
path('accounts/profile/', ConfirmEmailSuccessView.as_view()),
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user