Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Doesn't work for gzipped items #46

Closed
manterfield opened this issue Jun 24, 2014 · 7 comments · Fixed by #117
Closed

Doesn't work for gzipped items #46

manterfield opened this issue Jun 24, 2014 · 7 comments · Fixed by #117

Comments

@manterfield
Copy link

If AWS_IS_GZIPPED is set to True, then this will check the hash of the un-gzipped item against the etag of the gzipped item, which will obviously not match (though once upon a time it used to, but amazon fixed that).

This means all js and css files on a set-up using gzipping will be copied on every collect.

@antonagestam
Copy link
Owner

I've never used AWS_IS_GZIPPED. Pull requests are welcome.

@manterfield
Copy link
Author

I would love to because I need this myself, though in all honesty I can't think of a good solution to it. I was hoping someone that has more experience with the staticfiles stuff could think of something brilliant.

My (admittedly brief) time thinking about this made me wonder how I'd go about getting either two gzip hashes or two non gzip hashes to compare, without having to do extra gzips or storages of files on s3 all over the job.

If you have anything for a nudge in the right direction, I would be more than happy to code it up.

@antonagestam
Copy link
Owner

It definitely adds some complexity to the project, but since this project is all about optimizing collectstatic as much as possible, I think it's worth it.

The solution I can think of from the top of my head would be to edit get_file_hash in collectstatic/management/commands.py and add some condition to check if it should create a gzipped hash or not (I read somewhere that AWS_IS_GZIPPED works in conjunction with GZIP_CONTENT_TYPES). If gzipping adds a lot of overhead, that could possibly be cached too with the hash of the raw file as key: {'<raw file hash>': '<gzipped file hash>'}.

Not sure if this will work and I'm sure there's more to it than that, I'll be happy to keep the discussion going and review any pull requests! 🍰 👍

@manterfield
Copy link
Author

Huh, I like that. I think that might have legs.

I'll not have much of a chance to do anything on this until the weekend, but I'll see about cobbling something together then.

👍

@antonagestam
Copy link
Owner

@tomdickin Do you have any idea how Django 1.7 does this? Basically they've implemented collectfast in much nicer way with ManifestStaticFilesStorage and CachedStaticFilesStorage.

@lakshbhasin
Copy link

I was wondering if there have been any updates on this, or if anyone has worked on a PR to fix it? I've been encountering the same issue.

@antonagestam
Copy link
Owner

Not as far as I know, feel free to dive in!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants