Question

I'm using django-compressor to compress my css, so i wrote next in HTML:

{% load compress %}

{% compress css %}

<link rel="stylesheet" href="{{ STATIC_URL }}styles/blueprint/reset.css" media="all" />

<link rel="stylesheet" href="{{ STATIC_URL }}styles/base.css" media="all" />

<link rel="stylesheet" href="{{ STATIC_URL }}styles/header.css" media="all" />

<link rel="stylesheet" href="{{ STATIC_URL }}styles/footer.css" media="all" />

<link rel="stylesheet" href="{{ STATIC_URL }}styles/frontpage.css" media="all" />

<link rel="stylesheet" href="{{ STATIC_URL }}styles/about.css" media="all" />
{% endcompress %}

And it gives the following error:

500 page with: 
UncompressableFileError: 'styles/blueprint/reset.css' isn't accesible
via COMPRESS_URL ('/media/static/') and can't be compressed

BTW: all files are in the static path, so they will work if i comment compression.

My settings.py about compress:

COMPRESS_STORAGE = 'compressor.storage.GzipCompressorFileStorage'
COMPRESS_CSS_FILTERS = ['compressor.filters.csstidy.CSSTidyFilter',       'compressor.filters.css_default.CssAbsoluteFilter']
COMPRESS_CSSTIDY_BINARY = '/usr/bin/csstidy'
COMPRESS_CSSTIDY_ARGUMENTS = '--template=highest --remove_last_;=true --sort_properties=false --sort_selectors=false --merge_selectors=1'
COMPRESS_ROOT = STATIC_ROOT
COMPRESS_URL = STATIC_URL
Was it helpful?

Solution

I had same problem. I don't know why, but my solution is removing of parameter --remove_last_;=true.

OTHER TIPS

I had a similar problem, do you render your template with RequestContext as context_instance?

E.g.:

def some_view(request):
    ...
    return render_to_response(... , context_instance=RequestContext(request))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top