From 3f17da684eb33e6184dd160c097f5e06e52b3e8f Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Tue, 8 Jul 2025 22:11:20 +0200 Subject: [PATCH] [FIX] Don't use `static` for the `custom-styles.css` file Since this CSS file is not part of the regular static collection, but gets created on demand, `ManifestStaticFilesStorage` will not work here. So we have to call the file directly, instead via `static` or we get: ValueError: Missing staticfiles manifest entry for 'allianceauth/custom-styles.css' --- allianceauth/custom_css/templatetags/custom_css.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/allianceauth/custom_css/templatetags/custom_css.py b/allianceauth/custom_css/templatetags/custom_css.py index 3c01602f..bb342d33 100644 --- a/allianceauth/custom_css/templatetags/custom_css.py +++ b/allianceauth/custom_css/templatetags/custom_css.py @@ -8,7 +8,6 @@ from allianceauth.custom_css.models import CustomCSS # Django from django.conf import settings from django.template.defaulttags import register -from django.templatetags.static import static from django.utils.safestring import mark_safe from pathlib import Path @@ -20,7 +19,7 @@ def custom_css_static(path: str) -> str: Versioned static URL This is to make sure to break the browser cache on CSS updates. - Example: /static/allianceauth/custom-styles.css?v=1234567890 + Example: /static/allianceauth/custom-styles.css?v=1752004819.555084 :param path: :type path: @@ -42,7 +41,6 @@ def custom_css_static(path: str) -> str: custom_css_version = ( str(custom_css_changed).replace(" ", "").replace(":", "").replace("-", "") ) # remove spaces, colons, and dashes - static_url = static(path) - versioned_url = static_url + "?v=" + custom_css_version + versioned_url = f"{settings.STATIC_URL}{path}?v={custom_css_version}" return mark_safe(f'')