2

So I am using 'django-compressor' to compress all the css files. It does minify and merge all the css files into a single file '9756d9abb2c2.css' but the size of this single file is almost equal to the sum of all css files. And the Google PageSpeed still tells me that:

Compressing http://xxx/9756d9abb2c2.css could save 85.1KiB (87% reduction).

I am not sure what could be the problem :/

Edit: Here are the settings i have:

DEBUG = True
STATIC_ROOT = ''
STATIC_URL = '/stic/'
STATICFILES_DIRS = (
    'static',
)
COMPRESS_OFFLINE_CONTEXT = {
'STATIC_URL': '/stic/',
}
COMPRESS_ENABLED = True
COMPRESS_OUTPUT_DIR = 'static/CACHE'

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',      # compressor (compress css and js files)
)
MIDDLEWARE_CLASSES = (
    ####...
    'django.middleware.gzip.GZipMiddleware',        #enable gzip compression for html
)
suneet
  • 400
  • 1
  • 5
  • 19
  • Do you have `COMPRESS_ENABLED` setting set to `True`? – alecxe Jul 03 '14 at 16:01
  • Yes and the compressor is working as far as minifying and combining css files is concerned. But it isn't gziping. Could it be because of the URLs? – suneet Jul 03 '14 at 17:25
  • @suneet you got any solution for this or the reason why this is happening ?? – Inforian Jul 14 '14 at 06:51
  • Yup. That worked. Thanks a lot. Also, in my case this saved 85.1KiB (87% reduction) so i guess it's better to use it for css. Again, thanks a lot. Live Long and Prosper :) – suneet Jul 15 '14 at 11:55
  • @suneet can you please explain exactly what it is that "worked". To whom are you replying to when you say "that worked"? I have exactly the same problem and I can't find anything that works. Also the question is marked as duplicate but the previous question that it points to does not seem relevant to me. – panosmm Oct 26 '14 at 08:49
  • [This](http://stackoverflow.com/a/14408172/1820126) is actually relevant. You'll need to use `manage.py runserver --nostatic 8000` instead of `manage.py runserver 8000`. If this answer doesn't help, post your question as a different post. Another thing to note is that `django-compressor` only minifies and doesn't actually "gzip compress". `GZipMiddleware` does the compression part. – suneet Oct 29 '14 at 06:00

0 Answers0