Skip to content

Commit

Permalink
Merge pull request #296 from ita-social-projects/#280exploreSwagger
Browse files Browse the repository at this point in the history
#280explore swagger
  • Loading branch information
BelousSofiya authored Nov 9, 2023
2 parents ce13f64 + 2283d03 commit 4ec662a
Show file tree
Hide file tree
Showing 4 changed files with 2,643 additions and 0 deletions.
9 changes: 9 additions & 0 deletions forum/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"profiles",
"administration",
"search",
"drf_spectacular",
]

MIDDLEWARE = [
Expand Down Expand Up @@ -170,6 +171,14 @@
"authentication.authentication.DjoserTokenAuthentication",
),
"DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.AllowAny"],
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}

SPECTACULAR_SETTINGS = {
"TITLE": "Forum Project",
"DESCRIPTION": "Your project description",
"VERSION": "1.0.0",
"SERVE_INCLUDE_SCHEMA": False,
}

TOKEN_EXPIRATION_TIME = timedelta(days=14)
Expand Down
7 changes: 7 additions & 0 deletions forum/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""
from django.contrib import admin
from django.urls import include, path
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView

urlpatterns = [
path("admin/", admin.site.urls),
Expand All @@ -25,4 +26,10 @@
include("administration.urls", namespace="administration"),
),
path("api/", include("search.urls", namespace="search")),
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
path(
"api/schema/docs/",
SpectacularSwaggerView.as_view(url_name="schema"),
name="schema_docs",
),
]
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ django-filter==23.2
gunicorn==21.2.0
toml==0.10.2
black==23.9.1
drf-spectacular==0.26.5

Loading

0 comments on commit 4ec662a

Please sign in to comment.