From 4ee4b380f1fb35e94691843764890fea023aa5d0 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Mon, 7 Dec 2020 14:13:39 +0100 Subject: [PATCH] problem with collectstatic fixed --- smash/smash/settings.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/smash/smash/settings.py b/smash/smash/settings.py index dac4ff04..f705fad5 100644 --- a/smash/smash/settings.py +++ b/smash/smash/settings.py @@ -10,8 +10,11 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.10/ref/settings/ """ +import functools import os +from django.contrib.staticfiles import storage + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PROJECT_PATH = os.path.abspath(os.path.dirname(__file__)) @@ -127,7 +130,7 @@ NPM_FILE_PATTERNS = { 'datatables.net-bs': ['css/*', 'js/*', 'License.txt'], 'datatables.net-buttons': ['js/*', 'License.txt'], 'datatables.net-buttons-bs': ['js/*', 'css/*', 'License.txt'], - 'eonasdan-bootstrap-datetimepicker': ['build/*', 'LICENSE'], + 'eonasdan-bootstrap-datetimepicker': ['build/js/*', 'build/css/bootstrap-datetimepicker.*', 'LICENSE'], 'font-awesome': ['css/*', 'fonts/*', 'less/*', 'scss/*'], 'fullcalendar': ['dist/*', 'license.txt'], 'fullcalendar-scheduler': ['dist/*', 'LICENSE.md'], @@ -135,7 +138,7 @@ NPM_FILE_PATTERNS = { 'icheck': ['skins/*', 'icheck*'], 'ionicons': ['css/*', 'fonts/*', 'less/*', 'png/*', 'scss/*', 'LICENSE'], 'jquery': ['dist/*'], - 'jquery-ui-dist': ['jquery-ui*', 'LICENSE.txt'], + 'jquery-ui-dist': ['jquery-ui*', 'images/*', 'LICENSE.txt'], 'jspdf': ['dist/*'], 'jszip': ['dist/*'], 'moment': ['min/*'], @@ -181,3 +184,17 @@ if FORCE_2FA: MIDDLEWARE.append('smash.middleware.force_2fa_middleware.Force2FAMiddleware') NPM_STATIC_FILES_PREFIX = 'npm' + +# *************** +# hacky way to fix problem with '"' in css files that generate errors on collectstatic django command +# *************** +original_hashed_name = storage.HashedFilesMixin.hashed_name + + +@functools.wraps(original_hashed_name) +def hashed_name(self, name, *args, **kwargs): + return original_hashed_name(self, name.replace('"', ''), *args, **kwargs) + + +storage.HashedFilesMixin.hashed_name = hashed_name +# *************** -- GitLab