Ben Davis
Ben Davis

Reputation: 13830

django-compressor not working on less files in production

I'm not sure what caused this, it was working earlier. The problem is that I'm not getting any useful debug information in my logs, so I don't know where the failure is occurring.

{% compress css %}
<link rel="stylesheet" type="text/less" href="{{ STATIC_URL }}css/style.less" />
{% block extrastyle %}  
{% endblock %}
{% endcompress %}

It's not processing the less file. The output is currently:

<link rel="stylesheet" type="text/less" href="/static/css/style.less" />

It is, however, minifying the javascript I have at the end of the <body> tag, so compress is enabled, but it's just not processing the less block.

My production settings have DEBUG=False. I got into a shell using manage.py shell --settings=settings.production, and checked my django settings:

from django.conf import settings
>>> settings.COMPRESS_ENABLED
True
>>> settings.COMPRESS_PRECOMPILERS
(('text/less', 'lessc {infile} {outfile}'),)

lessc seems to work fine from commandline:

$ lessc test.css /tmp/out.css

How can I find out what's causing this to happen?

Upvotes: 1

Views: 857

Answers (2)

Ben Davis
Ben Davis

Reputation: 13830

This turned out to be an issue with my less path. The lessc binary that was being run was a different version than the one that needed to be run.

Upvotes: 0

a_dreb
a_dreb

Reputation: 189

Try ./manage.py compress --force and that will force compress your assets and show which line, if any, is tripping it up. My project had small @import reference problems and that broke it in production.

Upvotes: 2

Related Questions