From cec74102495ab7434aa73b257e4394766edaf078 Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Mon, 16 Feb 2026 17:56:05 +0100 Subject: [PATCH] updated cache --- backend/holy_backend/settings.py | 12 ++++++++++++ docker-compose.yml | 13 +++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/backend/holy_backend/settings.py b/backend/holy_backend/settings.py index d504a8c..3ed1303 100644 --- a/backend/holy_backend/settings.py +++ b/backend/holy_backend/settings.py @@ -94,6 +94,18 @@ DATABASES = { } } +# Cache configuration for Ratelimiting +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', + 'LOCATION': os.path.join(BASE_DIR, 'django_cache'), + } +} + +# Silence the ratelimit error for locmem if it appears, +# though we just switched to file-based which is supported. +SILENCED_SYSTEM_CHECKS = ['django_ratelimit.E003'] + # Password validation # https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators diff --git a/docker-compose.yml b/docker-compose.yml index 9cf7619..368b075 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ +version: '3.8' + services: # --- Backend Service (Gunicorn + WhiteNoise) --- backend: @@ -9,7 +11,7 @@ services: - narl - internal env_file: - - .env + - .env.narl.io volumes: - ./backend:/app - ./legacy:/app/legacy @@ -23,7 +25,6 @@ services: labels: - "traefik.enable=true" - "traefik.docker.network=narl" - # Using a unique project-specific router name to avoid network conflicts - "traefik.http.routers.holy-energy-backend.priority=100" - "traefik.http.routers.holy-energy-backend.rule=Host(`holy.narl.io`) && (PathPrefix(`/api`) || PathPrefix(`/admin`) || PathPrefix(`/static`) || PathPrefix(`/media`))" - "traefik.http.routers.holy-energy-backend.entrypoints=websecure" @@ -41,15 +42,16 @@ services: networks: - narl env_file: - - .env + - .env.narl.io depends_on: - backend labels: - "traefik.enable=true" - "traefik.docker.network=narl" - # Lower priority fallback + # Higher priority for backend paths is set on the backend router, + # but we use an explicit exclusion here to be 100% safe. - "traefik.http.routers.holy-energy-frontend.priority=10" - - "traefik.http.routers.holy-energy-frontend.rule=Host(`holy.narl.io`)" + - "traefik.http.routers.holy-energy-frontend.rule=Host(`holy.narl.io`) && !(PathPrefix(`/api`) || PathPrefix(`/admin`) || PathPrefix(`/static`) || PathPrefix(`/media`))" - "traefik.http.routers.holy-energy-frontend.entrypoints=websecure" - "traefik.http.routers.holy-energy-frontend.tls.certresolver=https_resolver" - "traefik.http.services.holy-energy-frontend.loadbalancer.server.port=80" @@ -62,4 +64,3 @@ networks: volumes: db_data: -