-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathurls.py
27 lines (26 loc) · 876 Bytes
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from django.contrib import admin
from django.urls import include, path
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAdminUser, IsAuthenticated
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("users.urls")),
path(
"docs/schema.yml",
SpectacularAPIView.as_view(
permission_classes=[IsAuthenticated, IsAdminUser],
authentication_classes=[SessionAuthentication],
),
name="schema",
),
path(
"docs/",
SpectacularSwaggerView.as_view(
url_name="schema",
permission_classes=[IsAuthenticated, IsAdminUser],
authentication_classes=[SessionAuthentication],
),
name="swagger-ui",
),
]