2

I use amazon s3 to store static files and django-compressor to compress js and css files with COMPRESS_OFFLINE = True.

To deploy to my production server, I first run python manage.py compress, which uploads the compressed files to Amazon s3 and then do a git push to my repo. At the production server, I pull from this repo and I always encounter synchronization problem between for the generated css and js files.

I search possibilities and noticed that compressor actually looks at the modified time of compressed files. When I check the modified date between static files in my static folder of my app (not S3 files), I noticed that they are different, I believe the reason is git changes the modified date of changed files.

How can I fix this?

Thanks

Hellnar
  • 62,315
  • 79
  • 204
  • 279
  • Are you tracking the compressed files in git? – jdi Nov 21 '12 at 04:47
  • @jdi I track uncompressed ones on git. Compressed files are uploaded to my amazon S3 bucket. Server and local machines check the modified time while matching if any file has been changed since the last compression and that's where I fail. – Hellnar Nov 21 '12 at 05:25
  • Could you expand a bit? You compress and upload js & css files to S3 bucket. Then you commit and push uncompressed files; are these files modified by `manage.py compress` (js & css links get updated in *.html templates to refer to amazon servers) or do you push original files? Another question: do you compress and send the same files on a production server as well? What result do you expect? Unfortunately, it's not clear so far. – vadishev Nov 25 '12 at 04:16
  • I think this question might be related: http://stackoverflow.com/questions/1964470/whats-the-equivalent-of-use-commit-times-for-git You could look at the second answer (not the accepted one). May help. – GregHNZ Nov 27 '12 at 06:42
  • Is your last commit before or after compressing and uploading to S3? My guess is you commit, run compress and at that point the files are "modified" by django-compressor. Try compress before your final commit/merge. – Enrico Nov 27 '12 at 22:13

1 Answers1

1

Check if your server Git repo (to which you are pulling) doesn't have

  • any .gitattributes content filter driver (which would automatically modify the content of those files),
  • any local or global settings, like core.autocrlf, which would modify the eol (end of line) style.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250