From 67095752d2332bf4db0bf6c0c1b49c6d85159fcc Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 23 Aug 2022 08:39:38 +0100 Subject: [PATCH] Add caching to schema views --- website/api/urls.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/website/api/urls.py b/website/api/urls.py index ce52ec9..4a90671 100644 --- a/website/api/urls.py +++ b/website/api/urls.py @@ -27,16 +27,13 @@ schema_view = get_schema_view( urlpatterns = [ re_path( r"^swagger(?P\.json|\.yaml)$", - schema_view.without_ui(cache_timeout=0), + schema_view.without_ui(cache_timeout=60 * 60), name="schema-json", ), - re_path( - r"^swagger/$", - schema_view.with_ui("swagger", cache_timeout=0), + path( + "swagger/", + schema_view.with_ui("swagger", cache_timeout=60 * 60), name="schema-swagger-ui", ), - re_path( - r"^redoc/$", schema_view.with_ui("redoc", cache_timeout=0), name="schema-redoc" - ), path("", RedirectView.as_view(pattern_name="api:schema-swagger-ui")), ] + api_urlpatterns