diff options
author | Michael Manfre | 2022-12-05 12:55:30 -0500 |
---|---|---|
committer | GitHub | 2022-12-05 10:55:30 -0700 |
commit | d6eb16a398a8d3a2f58399fd40df7f212680cab0 (patch) | |
tree | 5561d7c7d33850672e300ba4320ece1e588dbb1b /takahe | |
parent | a9bb4a7122df6d9d4a764de52244c6ec75789ead (diff) | |
download | takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.tar.gz takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.tar.bz2 takahe-d6eb16a398a8d3a2f58399fd40df7f212680cab0.zip |
Added caching and initial settings
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", |