Django collectstatic from Heroku pushes to S3 everytime

前端 未结 6 1339
忘了有多久
忘了有多久 2021-02-02 01:23

I\'m using django-storages for static files with S3 (and S3BotoStorage). When I do collectstatic from my local machine, the behaviour is as expected, where only modified files a

6条回答
  •  梦如初夏
    2021-02-02 01:49

    I've just had that exact same issue and contacted Heroku's support to find out what is going on. My question to them was

    I've run into a funky issue doing some deployments. It appears that on each push the date modified on all files is updated to the time a new deploy/git push happens. Is this intended behaviour?

    When considering that Django's collectstatic command only checks the modified date on files when evaluating if the file should be copied across to the final storage backend for static assets, it means that on each new push, all files are first removed from the remote storage (in this case S3) and then re-uploaded. This is both a very slow and wasteful process in terms of bandwidth consumed and requests made.

    The answer I received today from "Caio", one of Heroku's support staff, was

    Hi, that's how it currently works, yes. I'm routing your feedback to our runtime team to see if we can package files with their original dates.

提交回复
热议问题