Add caching to schema views

This commit is contained in:
Jake Howard 2022-08-23 08:39:38 +01:00
parent 8dea738893
commit 67095752d2
Signed by: jake
GPG Key ID: 57AFB45680EDD477

View File

@ -27,16 +27,13 @@ schema_view = get_schema_view(
urlpatterns = [
re_path(
r"^swagger(?P<format>\.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