Question

I have been using django-pipeline successfully for a couple of months. Now I have installed virtual-env for the first time on a clean system. Everything is accordingly set and all pip installs are done within my environment.

python manage.py collectstatic

Now I get an error when I am collecting my static files, it says

File "/vc/cb-env/local/lib/python2.7/site-packages/pipeline/compressors/__init__.py", line 247, in execute_command
    raise CompressorError(error)
pipeline.compressors.CompressorError: [warning] /usr/bin/yui-compressor: No java runtime was found
[warning] /usr/bin/yui-compressor: No JAVA_CMD set for run_java, falling back to JAVA_CMD = java

Even though both yui-compressor as well as latest java were installed previously:

sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java7-installer -y
sudo apt-get install yui-compressor -y

By the look of it, because I had installed java as root, my environment doesn't seem to find it. What can I do?

Was it helpful?

Solution

Not a direct solution but after some research and chat with the maker of django-pipeline it seems that Yui-Compressor is deprecated anyway and replaced by Yuglify.

Hence its best to keep the django settings.py as it is and simply install Yuglify instead.

sudo apt-get install npm
(switch your virtualenv's environment)
npm install yuglify

The settings.py needs to change only one line:

PIPELINE_YUI_BINARY = '/vc/{your-project-env}/site/{your-project}/node_modules/yuglify/bin/yuglify'

Thats it and it works.

UPDATE:

In the latest django-pipeline You can't set the YUI binary to Yuglify anymore. You have explicitely declare the yuglify binary. But otherwise nothing changes:

PIPELINE_YUGLIFY_BINARY = "/vc/{yourproject-env}/node_modules/yuglify/bin/yuglify"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top