diff options
Diffstat (limited to 'takahe')
-rw-r--r-- | takahe/settings.py | 11 | ||||
-rw-r--r-- | takahe/urls.py | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/takahe/settings.py b/takahe/settings.py index 7952024..9769e98 100644 --- a/takahe/settings.py +++ b/takahe/settings.py @@ -6,6 +6,7 @@ from pathlib import Path from typing import Literal import dj_database_url +import django_cache_url import sentry_sdk from pydantic import AnyUrl, BaseSettings, EmailStr, Field, validator from sentry_sdk.integrations.django import DjangoIntegration @@ -15,6 +16,11 @@ from takahe import __version__ BASE_DIR = Path(__file__).resolve().parent.parent +class CacheBackendUrl(AnyUrl): + host_required = False + allowed_schemes = django_cache_url.BACKENDS.keys() + + class ImplicitHostname(AnyUrl): host_required = False @@ -107,6 +113,9 @@ class Settings(BaseSettings): #: (placeholder setting, no effect) SEARCH: bool = True + #: Default cache backend + CACHES_DEFAULT: CacheBackendUrl | None = None + PGHOST: str | None = None PGPORT: int | None = 5432 PGNAME: str = "takahe" @@ -339,5 +348,7 @@ if SETUP.MEDIA_BACKEND: else: raise ValueError(f"Unsupported media backend {parsed.scheme}") +CACHES = {"default": django_cache_url.parse(SETUP.CACHES_DEFAULT or "dummy://")} + if SETUP.ERROR_EMAILS: ADMINS = [("Admin", e) for e in SETUP.ERROR_EMAILS] diff --git a/takahe/urls.py b/takahe/urls.py index 59f14ba..a6e8a6e 100644 --- a/takahe/urls.py +++ b/takahe/urls.py @@ -56,6 +56,11 @@ urlpatterns = [ name="admin_basic", ), path( + "admin/tuning/", + admin.TuningSettings.as_view(), + name="admin_tuning", + ), + path( "admin/domains/", admin.Domains.as_view(), name="admin_domains", |