wger: ACTUALLY enable Redis

This commit is contained in:
eyjhb 2024-12-06 18:43:05 +01:00
parent 51bb437838
commit 3121b57181
No known key found for this signature in database
GPG key ID: 609F508E3239F920
2 changed files with 11 additions and 7 deletions

View file

@ -13,8 +13,8 @@ let
ALLOW_REGISTRATION = true;
ALLOW_GUEST_USERS = true;
ALLOW_UPLOAD_VIDEOS = false;
MIN_ACCOUNT_AGE_TO_TRUST = 21;
EXERCISE_CACHE_TTL = 3600;
MIN_ACCOUNT_AGE_TO_TRUST = 1;
EXERCISE_CACHE_TTL = 3600; # 1 hour
};
django_settings = rec {
@ -54,10 +54,12 @@ let
EMAIL_PAGE_DOMAIN = SITE_URL;
# Cache - Redis
DJANGO_CACHE_BACKEND = "django_redis.cache.RedisCache";
DJANGO_CACHE_LOCATION = "${config.services.redis.servers.wger.unixSocket}";
DJANGO_CACHE_TIMEOUT = 1296000; # in seconds - 60*60*24*15, 15 Days
DJANGO_CACHE_CLIENT_CLASS = "django_redis.client.DefaultClient";
CACHES.default = {
BACKEND = "django_redis.cache.RedisCache";
LOCATION = "unix://${config.services.redis.servers.wger.unixSocket}";
TIMEOUT = 15 * 24 * 60 * 60; # 15 days
OPTIONS.CLIENT_CLASS = "django_redis.client.DefaultClient";
};
# setup allowed hosts
CSRF_TRUSTED_ORIGINS = [ "https://${svc_domain}" ];
@ -172,7 +174,7 @@ in {
services.redis.servers.wger = {
enable = true;
user = wger_user;
appendOnly = true;
# appendOnly = true;
};
# setup users

View file

@ -72,6 +72,8 @@ in python3.pkgs.buildPythonPackage rec {
tzdata
# extra??
redis
django-redis
drf-spectacular-sidecar
(python3.pkgs.callPackage ./django-bootstrap-breadcrumbs.nix {})
psycopg2