3
votes

Configuration of Pipeline to compress css files is this:

PIPELINE_CSS = {
                'colors': {
                          'source_filenames': (
                                               '/static/css/colors/colors.css',
                                               '/static/css/colors/layout.css'
                                               ),
                          'output_filename': '/static/css/Colors.css',
                    },
                }

but when the client tries to get

/static/css/Colors.css with

{% load compressed %}    
{% compressed_css 'colors' %} 

it returns 404, Not found. If i run collectstatic no files (like /static/css/Colors.css) are generated in STATIC_ROOT.

I have installed YUI Compressor from Synaptic Repository of my Ubuntu Lucid.

EDIT1: Other of settings.py:

PIPELINE_STORAGE = 'pipeline.storage.PipelineFinderStorage'

STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'

PIPELINE=True

In middleware classes:

'django.middleware.gzip.GZipMiddleware',

'pipeline.middleware.MinifyHTMLMiddleware',

STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', # 'django.contrib.staticfiles.finders.DefaultStorageFinder', )

STATICFILES_DIRS = ( "/home/my/eclipse/myproject/static/", )

STATIC_URL = '/static/'

STATIC_ROOT = '/home/my/eclipse/myproject/static2/'

2
You need to specify relative paths to files, isn't you?neoascetic
@neoasceetic i have static files out of the source folder. So i think that if i use relative paths the files aren't found.Giovanni Bitliner
Why so? Static files must be inside your source dir by defenition, unlike media filesneoascetic
Because source folder, that contains python code, is private, but the js and css files are public, so i have to distinguish this fact.Giovanni Bitliner
Why not copy/link this files?neoascetic

2 Answers

1
votes

You need to use relative paths to source files since pipeline use staticfiles app to find this files.

Read more about staticfiles management in Django

0
votes

What is the last line when you run collectstatic?

I noticed it writes to /tmp instead of STATIC_ROOT .

removing these 2 lines seems to fix it:

PIPELINE_STORAGE = 'pipeline.storage.PipelineFinderStorage'
STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage' 

( btw, the syntax has changed to {% load pipeline %} {% stylesheet 'colors' %} )