Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gzip #36

Closed
chrisdl opened this issue Apr 9, 2014 · 3 comments
Closed

gzip #36

chrisdl opened this issue Apr 9, 2014 · 3 comments

Comments

@chrisdl
Copy link

chrisdl commented Apr 9, 2014

My JS/CSS assets (which are served off of CloudFront are not being Gzipped). I am pushing the assets to S3 using:

class OptimizedCachedS3BotoStorage(FolderNameHackMixin, OptimizedFilesMixin, CachedFilesMixin, S3BotoStorage):

I've been reading up on it a bit, and it seems that if you need to gzip it before your push to cloudfront, remove the .gz part and set the content type to gzip on the asset in S3. This should obviously be handled automatically, but it seems crazy that the collectstatic pushing it to S3 doesn't handle it automatically. Any thoughts about how to integrate it or what setting is needed for this?

@etianen
Copy link
Owner

etianen commented Apr 9, 2014

Just set AWS_IS_GZIPPED = True in your settings.py. It's a feature of django-storages.

Happy coding!

On 9 Apr 2014, at 19:44, Chris notifications@github.com wrote:

My JS/CSS assets (which are served off of CloudFront are not being Gzipped). I am pushing the assets to S3 using:

class OptimizedCachedS3BotoStorage(FolderNameHackMixin, OptimizedFilesMixin, CachedFilesMixin, S3BotoStorage):
I've been reading up on it a bit, and it seems that if you need to gzip it before your push to cloudfront, remove the .gz part and set the content type to gzip on the asset in S3. This should obviously be handled automatically, but it seems crazy that the collectstatic pushing it to S3 doesn't handle it automatically. Any thoughts about how to integrate it or what setting is needed for this?


Reply to this email directly or view it on GitHub.

@chrisdl
Copy link
Author

chrisdl commented Apr 9, 2014

That's crazy that I haven't seen that! My move was this (which I saw somewhere else)

GZIP_CONTENT_TYPES = (
    'text/css',
    'application/javascript',
    'application/x-javascript',
    'text/javascript'
)

I'll try it with one and the other and report back.

@chrisdl
Copy link
Author

chrisdl commented Apr 10, 2014

Your way worked and mine didn't.

adding

AWS_IS_GZIPPED = True

to the settings.py file shaved 86% off the size of the css file! Aka, totally worth the added CPU to unzip it. Thanks for the help.

@etianen etianen closed this as completed Sep 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants