Updated configuration settings

master
Anulax ago%!(EXTRA string=1 month)
parent 6d65ab7030
commit 57a1ed2410
  1. 36
      botzilla/docs.py
  2. 7
      botzilla/settings.py
  3. 22
      botzilla/urls.py

@ -0,0 +1,36 @@
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from drf_yasg.generators import OpenAPISchemaGenerator
from drf_yasg.views import get_schema_view
from rest_framework import permissions
class SubTagSchemaGenerator(OpenAPISchemaGenerator):
def get_schema(self, request=None, public=False):
schema = super().get_schema(request, public)
# Add x-tagGroups extension for ReDoc
schema['x-tagGroups'] = [
{
"name": "v1",
"tags": ["token", "conversations"]
}
]
return schema
schema_view = get_schema_view(
openapi.Info(
title="Botzilla API",
default_version='v1',
description="Botzilla API documentation",
terms_of_service="https://www.example.com/terms/",
contact=openapi.Contact(email="contact@botzilla.ch"),
license=openapi.License(name="BSD License"),
x_logo={
"url": "/static/logo.svg",
"backgroundColor": "#FFFFFF",
"altText": "Botzilla logo"
}
),
public=True,
permission_classes=[permissions.AllowAny],
generator_class=SubTagSchemaGenerator
)

@ -42,7 +42,7 @@ INSTALLED_APPS = [
'rest_framework_simplejwt',
'rest_framework_simplejwt.token_blacklist',
'api',
'app',
'drf_yasg',
]
@ -59,8 +59,8 @@ REST_FRAMEWORK = {
}
SIMPLE_JWT = {
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60 * 12),
'REFRESH_TOKEN_LIFETIME': timedelta(days=1),
'ACCESS_TOKEN_LIFETIME': timedelta(minutes=60 * 72),
'REFRESH_TOKEN_LIFETIME': timedelta(days=31),
'ALGORITHM': 'HS256',
'SIGNING_KEY': SECRET_KEY,
'VERIFYING_KEY': None,
@ -69,7 +69,6 @@ SIMPLE_JWT = {
}
SWAGGER_SETTINGS = {
'FAVICON_HREF': '/static/favicon.ico',
'SECURITY_DEFINITIONS': {
'Bearer': {
'type': 'apiKey',

@ -17,29 +17,11 @@ Including another URLconf
from django.contrib import admin
from django.urls import path, include
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="Botzilla API",
default_version='v1',
description="Botzilla API documentation",
terms_of_service="https://www.example.com/terms/",
contact=openapi.Contact(email="contact@botzilla.ch"),
license=openapi.License(name="BSD License"),
x_logo={
"url": "/static/logo.svg",
"backgroundColor": "#FFFFFF",
"altText": "Botzilla logo"
}
),
public=True,
permission_classes=[permissions.AllowAny],
)
from .docs import schema_view
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('api.urls')),
path('app/', include('app.urls')),
path('docs/', schema_view.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
]

Loading…
Cancel
Save