Skip to content

Commit ed0ec42

Browse files
committed
Remove django-compressor, it's no longer needed
The CDN frontend compresses JavaScript and CSS instead.
1 parent 85445e1 commit ed0ec42

File tree

9 files changed

+10
-51
lines changed

9 files changed

+10
-51
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,9 @@ RUN rm /app/src/*/settings/local.py* && \
8585
chmod -R go+rw /app/web/media/ /app/web/static/CACHE /tmp/demo.db
8686

8787
# Insert main code (still as root), then reduce permissions
88-
# Allow to mount the compressor cache as volume too for sharing between pods.
8988
COPY deployment/docker/uwsgi.ini /app/uwsgi.ini
9089
CMD ["/usr/local/bin/uwsgi", "--ini", "/app/uwsgi.ini"]
9190
VOLUME /app/web/media
92-
VOLUME /app/web/static/CACHE
9391

9492
# Tag the docker image
9593
ARG GIT_VERSION

README.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ Some application settings can be overwritten by defining these environment varia
6262

6363
* ``ALLOWED_HOSTS`` A list of hostnames, or ``*`` for all.
6464
* ``CACHE_URL`` to point to a cache server (memcached/redis, e.g. ``memcache://127.0.0.1:11211?TIMEOUT=86400&KEY_PREFIX=fluentdemo``).
65-
* ``COMPRESS_ENABLED`` True/False (to disable django-compressor_)
6665
* ``CSRF_COOKIE_SECURE`` True/False
6766
* ``DATABASE_URL`` to point to a database (e.g. ``postgresql://user:pass@host/dbname``).
6867
* ``DJANGO_DEBUG`` True/False
@@ -159,7 +158,6 @@ The django-fluent modules are licensed under the Apache License Version 2.0.
159158
.. Add links here:
160159
161160
.. _django-fluent: http://django-fluent.org/
162-
.. _django-compressor: https://django-compressor.readthedocs.io/
163161
.. _django-environ: https://django-environ.readthedocs.io/
164162
.. _LiveReload: http://livereload.com/
165163
.. _SASS: http://sass-lang.com/

src/fluentdemo/settings/defaults.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@
8484
'django.contrib.sites',
8585
'django.contrib.sitemaps',
8686
'django.contrib.staticfiles',
87-
'compressor',
8887

8988
# Site parts
9089
'frontend',
@@ -174,12 +173,8 @@
174173
STATICFILES_FINDERS = (
175174
'django.contrib.staticfiles.finders.FileSystemFinder',
176175
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
177-
'compressor.finders.CompressorFinder',
178176
)
179177

180-
# Generate cache-busing static file names that can have a far-future expire headers
181-
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
182-
183178
MIDDLEWARE = (
184179
'raven.contrib.django.middleware.SentryMiddleware', # make 'request' available on all logs.
185180
'raven.contrib.django.middleware.Sentry404CatchMiddleware', # on 404, report to sentry.
@@ -317,19 +312,6 @@
317312

318313
COMMENTS_APP = 'fluent_comments'
319314

320-
COMPRESS_CSS_HASHING_METHOD = None # WhiteNoise already hashes files. Use 'content' otherwise for multi-server setups
321-
322-
COMPRESS_CSS_FILTERS = (
323-
'compressor.filters.css_default.CssAbsoluteFilter',
324-
'compressor.filters.cssmin.CSSMinFilter',
325-
)
326-
327-
COMPRESS_JS_FILTERS = (
328-
'compressor.filters.jsmin.JSMinFilter',
329-
)
330-
331-
COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', not DEBUG)
332-
333315
DJANGO_WYSIWYG_FLAVOR = 'tinymce_advanced'
334316

335317
FILE_UPLOAD_PERMISSIONS = 0o644 # Avoid 600 permission for filebrowser uploads.

src/fluentdemo/settings/docker.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
CACHES['axes'] = env.cache(default='dummycache://')
88
AXES_CACHE = 'axes'
99

10-
# When the container restarts, and memcache still indicates the files are present,
11-
# django-compressor will not recreate the files on the fly. Better use offline compression
12-
CACHES['compressor'] = env.cache('COMPRESSOR_CACHE', 'locmemcache://')
13-
COMPRESS_CACHE_BACKEND = 'compressor'
14-
COMPRESS_STORAGE = 'compressor.storage.GzipCompressorFileStorage' # generate .gz too for uwsgi static-gzip-dir
15-
1610
# Need to different way to get the release, since there is no .git folder to read.
1711
try:
1812
with open(SRC_DIR + '/.docker-git-version') as f:

src/fluentdemo/settings/production.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
# Change some defaults
99
DEBUG = env.bool('DJANGO_DEBUG', default=False)
10-
COMPRESS_ENABLED = env.bool('COMPRESS_ENABLED', not DEBUG)
1110
SESSION_COOKIE_SECURE = env.bool('SESSION_COOKIE_SECURE', not DEBUG)
1211
CSRF_COOKIE_SECURE = env.bool('CSRF_COOKIE_SECURE', not DEBUG)
1312

src/fluentdemo/settings/unittest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,5 @@
2626
'django.contrib.auth.hashers.MD5PasswordHasher',
2727
]
2828

29-
COMPRESS_ENABLED = True
30-
3129
# Avoid sending real emails
3230
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

src/frontend/templates/base.html

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% load analytical compress i18n static staff_toolbar_tags fluent_pages_tags fluent_contents_tags sharedcontent_tags %}<!doctype html>
1+
{% load analytical i18n static staff_toolbar_tags fluent_pages_tags fluent_contents_tags sharedcontent_tags %}<!doctype html>
22
<html xml:lang="{{ LANGUAGE_CODE|default:"en" }}" lang="{{ LANGUAGE_CODE|default:"en" }}">
33
<head>{% analytical_head_top %}
44
<meta charset="utf-8" />
@@ -18,11 +18,9 @@
1818
<meta property="og:url" content="{{ site_root }}{{ request.path }}" />
1919
<meta property="og:site_name" content="{{ site.name|default:site.domain }}" />
2020
<meta property="og:description" content="{% block og-description %}{{ page.description }}{% endblock %}" />
21-
{% compress css %}
2221
<link href="{% static 'frontend/css/screen.css' %}" rel="stylesheet" type="text/css" />
2322
<link href="{% static 'staff_toolbar/staff_toolbar.css' %}" rel="stylesheet" type="text/css" />
24-
{% endcompress %}
25-
{% compress css %}{% block link %}{% endblock %}{% endcompress %}
23+
{% block link %}{% endblock %}
2624
{% block extrahead %}{% endblock %}
2725
{% analytical_head_bottom %}
2826
</head>
@@ -66,19 +64,15 @@
6664
</footer>
6765
</div>
6866

69-
{% compress css %}{% render_content_items_media css %}{% endcompress %}
67+
{% render_content_items_media css %}
7068

71-
{% compress js %}
72-
<script type="text/javascript" src="{% static 'frontend/vendor/jquery.min.js' %}"></script>
73-
<script type="text/javascript" src="{% static 'frontend/vendor/bootstrap.min.js' %}"></script>
74-
{% endcompress %}<!-- common JS -->
69+
<script type="text/javascript" src="{% static 'frontend/vendor/jquery.min.js' %}"></script>
70+
<script type="text/javascript" src="{% static 'frontend/vendor/bootstrap.min.js' %}"></script>
7571

7672
{% render_content_items_media js external %}{# for django-fluent-contents #}
77-
{% compress js %}
78-
{% block script %}{% endblock %}{# for django-fluent-blogs/comments. #}
79-
{% block bodyscripts %}{% endblock %}
80-
{% render_content_items_media js local %}{# for django-fluent-contents #}
81-
{% endcompress %}<!-- page specific JS -->
73+
{% block script %}{% endblock %}{# for django-fluent-blogs/comments. #}
74+
{% block bodyscripts %}{% endblock %}
75+
{% render_content_items_media js local %}{# for django-fluent-contents #}
8276

8377
{% analytical_body_bottom %}
8478
</body>

src/requirements/base.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ django-any-imagefield == 1.1
4141
django-any-urlfield == 2.6.2
4242
django-axes == 5.3.0
4343
django-categories-i18n == 1.1.1
44-
django-compressor == 2.4
4544
django-contrib-comments == 1.9.2
4645
django-crispy-forms == 1.9.0
4746
django-environ == 0.4.5

src/requirements/base.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ django-admin-tools==0.9.0 # via -r requirements/base.in, django-fluent-dashboar
1616
django-analytical==2.5.0 # via -r requirements/base.in
1717
django-any-imagefield==1.1 # via -r requirements/base.in
1818
django-any-urlfield==2.6.2 # via -r requirements/base.in
19-
django-appconf==1.0.3 # via django-axes, django-compressor, fluentcms-emailtemplates
19+
django-appconf==1.0.3 # via django-axes, fluentcms-emailtemplates
2020
django-axes==5.3.0 # via -r requirements/base.in
2121
django-categories-i18n==1.1.1 # via -r requirements/base.in, django-fluent-blogs
22-
django-compressor==2.4 # via -r requirements/base.in
2322
django-contrib-comments==1.9.2 # via -r requirements/base.in, django-fluent-comments, django-threadedcomments
2423
django-crispy-forms==1.9.0 # via -r requirements/base.in, django-fluent-comments, fluentcms-contactform
2524
django-email-extras==0.3.4 # via django-forms-builder
@@ -100,12 +99,10 @@ python-gnupg==0.4.5 # via django-email-extras
10099
python-memcached==1.59 # via -r requirements/base.in
101100
pytz==2019.3 # via -r requirements/base.in, babel, django
102101
raven==6.10.0 # via -r requirements/base.in
103-
rcssmin==1.0.6 # via django-compressor
104102
redis==3.4.1 # via -r requirements/base.in, django-redis
105103
regex==2020.2.20 # via textile
106104
requests==2.23.0 # via django-healthchecks, python-akismet
107-
rjsmin==1.1.0 # via django-compressor
108-
six==1.14.0 # via django-appconf, django-compressor, django-contrib-comments, django-filebrowser-no-grappelli, django-fluent-contents, django-healthchecks, django-parler, django-simple-captcha, html5lib, packaging, python-memcached
105+
six==1.14.0 # via django-appconf, django-contrib-comments, django-filebrowser-no-grappelli, django-fluent-contents, django-healthchecks, django-parler, django-simple-captcha, html5lib, packaging, python-memcached
109106
smartypants==2.0.1 # via -r requirements/base.in
110107
sorl-thumbnail==12.6.3 # via -r requirements/base.in
111108
soupsieve==2.0 # via beautifulsoup4

0 commit comments

Comments
 (0)