Add caching to schema views
This commit is contained in:
parent
8dea738893
commit
67095752d2
1 changed files with 4 additions and 7 deletions
|
@ -27,16 +27,13 @@ schema_view = get_schema_view(
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
re_path(
|
re_path(
|
||||||
r"^swagger(?P<format>\.json|\.yaml)$",
|
r"^swagger(?P<format>\.json|\.yaml)$",
|
||||||
schema_view.without_ui(cache_timeout=0),
|
schema_view.without_ui(cache_timeout=60 * 60),
|
||||||
name="schema-json",
|
name="schema-json",
|
||||||
),
|
),
|
||||||
re_path(
|
path(
|
||||||
r"^swagger/$",
|
"swagger/",
|
||||||
schema_view.with_ui("swagger", cache_timeout=0),
|
schema_view.with_ui("swagger", cache_timeout=60 * 60),
|
||||||
name="schema-swagger-ui",
|
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")),
|
path("", RedirectView.as_view(pattern_name="api:schema-swagger-ui")),
|
||||||
] + api_urlpatterns
|
] + api_urlpatterns
|
||||||
|
|
Loading…
Reference in a new issue