Skip to content

Commit

Permalink
cache schema
Browse files Browse the repository at this point in the history
Signed-off-by: Jason <git@jasoncameron.dev>
  • Loading branch information
JasonLovesDoggo committed Feb 7, 2024
1 parent 8e161a6 commit cc29011
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion metropolis/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from django.contrib import admin
from django.http import FileResponse
from django.urls import include, path, re_path
from django.views.decorators.cache import cache_page
from drf_spectacular.views import (
SpectacularSwaggerView,
SpectacularAPIView,
Expand Down Expand Up @@ -52,7 +53,9 @@ def service_worker(request):
path("select2/", include("django_select2.urls")),
path("<path:url>", include("django.contrib.flatpages.urls")),
path("docs", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
path(
"api/schema/", cache_page(60 * 30)(SpectacularAPIView.as_view()), name="schema"
), # cache for 30m
path("docs/redoc/", SpectacularRedocView.as_view(url_name="schema"), name="redoc"),
]

Expand Down

0 comments on commit cc29011

Please sign in to comment.