mirror of
https://github.com/pretix/pretix.git
synced 2026-08-23 12:51:59 +00:00
Bump django-compressor to 3.1, get rid of annoying warnings (#2459)
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
#
|
||||||
|
# This file is part of pretix (Community Edition).
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014-2020 Raphael Michel and contributors
|
||||||
|
# Copyright (C) 2020-2021 rami.io GmbH and contributors
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
||||||
|
# Public License as published by the Free Software Foundation in version 3 of the License.
|
||||||
|
#
|
||||||
|
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
|
||||||
|
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
|
||||||
|
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
|
||||||
|
# this file, see <https://pretix.eu/about/en/license>.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||||
|
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||||
|
# details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||||
|
# <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
from django.template.loaders.app_directories import Loader
|
||||||
|
from django.template.utils import get_app_template_dirs
|
||||||
|
|
||||||
|
|
||||||
|
class AppLoader(Loader):
|
||||||
|
|
||||||
|
def get_dirs(self):
|
||||||
|
ds = get_app_template_dirs('templates')
|
||||||
|
ignore_patterns = {
|
||||||
|
# Ignore templates of plugins we don't actually use as they cause trouble during
|
||||||
|
# static file compression
|
||||||
|
'/django_filters/',
|
||||||
|
'/django_otp/',
|
||||||
|
}
|
||||||
|
return [d for d in ds if not any(p in str(d) for p in ignore_patterns)]
|
||||||
@@ -26,7 +26,7 @@ from urllib.parse import urljoin, urlsplit
|
|||||||
|
|
||||||
import django_libsass
|
import django_libsass
|
||||||
import sass
|
import sass
|
||||||
from compressor.filters.cssmin import CSSCompressorFilter
|
from compressor.filters.cssmin import CSSMinFilter
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.core.files.base import ContentFile, File
|
from django.core.files.base import ContentFile, File
|
||||||
@@ -115,7 +115,7 @@ def compile_scss(object, file="main.scss", fonts=True):
|
|||||||
include_paths=[sassdir], output_style='nested',
|
include_paths=[sassdir], output_style='nested',
|
||||||
custom_functions=cf
|
custom_functions=cf
|
||||||
)
|
)
|
||||||
cssf = CSSCompressorFilter(css)
|
cssf = CSSMinFilter(css)
|
||||||
css = cssf.output()
|
css = cssf.output()
|
||||||
cache.set('sass_compile_{}_{}'.format(cp, srcchecksum), css, 600)
|
cache.set('sass_compile_{}_{}'.format(cp, srcchecksum), css, 600)
|
||||||
|
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ CSRF_FAILURE_VIEW = 'pretix.base.views.errors.csrf_failure'
|
|||||||
|
|
||||||
template_loaders = (
|
template_loaders = (
|
||||||
'django.template.loaders.filesystem.Loader',
|
'django.template.loaders.filesystem.Loader',
|
||||||
'django.template.loaders.app_directories.Loader',
|
'pretix.helpers.template_loaders.AppLoader',
|
||||||
)
|
)
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
template_loaders = (
|
template_loaders = (
|
||||||
@@ -648,6 +648,10 @@ COMPRESS_PRECOMPILERS = (
|
|||||||
('text/vue', 'pretix.helpers.compressor.VueCompiler'),
|
('text/vue', 'pretix.helpers.compressor.VueCompiler'),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
COMPRESS_OFFLINE_CONTEXT = {
|
||||||
|
'basetpl': 'empty.html',
|
||||||
|
}
|
||||||
|
|
||||||
COMPRESS_ENABLED = COMPRESS_OFFLINE = not debug_fallback
|
COMPRESS_ENABLED = COMPRESS_OFFLINE = not debug_fallback
|
||||||
|
|
||||||
COMPRESS_FILTERS = {
|
COMPRESS_FILTERS = {
|
||||||
@@ -655,7 +659,10 @@ COMPRESS_FILTERS = {
|
|||||||
# CssAbsoluteFilter is incredibly slow, especially when dealing with our _flags.scss
|
# CssAbsoluteFilter is incredibly slow, especially when dealing with our _flags.scss
|
||||||
# However, we don't need it if we consequently use the static() function in Sass
|
# However, we don't need it if we consequently use the static() function in Sass
|
||||||
# 'compressor.filters.css_default.CssAbsoluteFilter',
|
# 'compressor.filters.css_default.CssAbsoluteFilter',
|
||||||
'compressor.filters.cssmin.CSSCompressorFilter',
|
'compressor.filters.cssmin.rCSSMinFilter',
|
||||||
|
),
|
||||||
|
'js': (
|
||||||
|
'compressor.filters.jsmin.JSMinFilter',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -165,13 +165,12 @@ setup(
|
|||||||
'celery==4.4.*',
|
'celery==4.4.*',
|
||||||
'chardet==4.0.*',
|
'chardet==4.0.*',
|
||||||
'cryptography>=3.4.2',
|
'cryptography>=3.4.2',
|
||||||
'csscompressor',
|
|
||||||
'css-inline==0.7.*',
|
'css-inline==0.7.*',
|
||||||
'defusedcsv>=1.1.0',
|
'defusedcsv>=1.1.0',
|
||||||
'dj-static',
|
'dj-static',
|
||||||
'Django==3.2.*',
|
'Django==3.2.*',
|
||||||
'django-bootstrap3==15.0.*',
|
'django-bootstrap3==15.0.*',
|
||||||
'django-compressor==2.4.*',
|
'django-compressor==3.1.*',
|
||||||
'django-countries==7.2.*',
|
'django-countries==7.2.*',
|
||||||
'django-filter==21.1',
|
'django-filter==21.1',
|
||||||
'django-formset-js-improved==0.5.0.2',
|
'django-formset-js-improved==0.5.0.2',
|
||||||
|
|||||||
Reference in New Issue
Block a user