I'm using django-pipeline with s3. I'm successfully using collectstatic
to combined my Javascript files and store them in my s3 bucket, but they are not getting compressed for some reason (verified by looking at the file, its size, and its content-encoding). Otherwise things are working correctly with the combined scripts.js
that is produced.
Here are the changes I made to use django-pipeline:
- Added
pipeline
to installed apps. - Added
'pipeline.finders.PipelineFinder'
toSTATICFILES_FINDERS
. - Set
STATICFILES_STORAGE = 'mysite.custom_storages.S3PipelineManifestStorage'
where this class is as defined in the documentation, as seen below. - Set
PIPELINE_JS
as seen below, which works but just isn't compressed. PIPELINE_ENABLED = True
sinceDEBUG = True
and I'm running locally.PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
even though this should be default.- Installed the Yuglify Compressor with
npm -g install yuglify
. PIPELINE_YUGLIFY_BINARY = '/usr/local/bin/yuglify'
even though the default withenv
should work.- Using the
{% load pipeline %}
and{% javascript 'scripts' %}
which work.
More detail:
PIPELINE_JS = {
'scripts': {
'source_filenames': (
'lib/jquery-1.11.1.min.js',
...
),
'output_filename': 'lib/scripts.js',
}
}
class S3PipelineManifestStorage(PipelineMixin, ManifestFilesMixin, S3BotoStorage):
location = settings.STATICFILES_LOCATION
As mentioned, collectstatic
does produce scripts.js
just not compressed. The output of that command includes:
Post-processed 'lib/scripts.js' as 'lib/scripts.js'
I'm using Django 1.8, django-pipeline 1.5.2, and django-storages 1.1.8.
Similar questions: