0

I've been working on Django project. Recently sometimes I have a trouble updating static files on S3. The changes on S3 cannot be reflected quickly. Also the speed of reflecting the changes depends on the browser. It takes more time to reflect the changes on Chrome than Edge for me. Is there a preferable way to prevent this?

I just did python manage.py collectstatic so static files can be updated. when I use Chrome, the files are still not updated even though two hours passed.

6
  • Dear maa, it would be nice if you elaborate a bit on your question and post some code as well as describe problems you experience. It would increase probability of getting an answer.
    – Artem
    Sep 14, 2018 at 12:26
  • That sound like it could be a caching problem. Have you tried clearing the browser cache? In chrome you can try Shift + F5 or Ctrl + F5.
    – Ralf
    Sep 14, 2018 at 14:16
  • It worked finally! Thank you so much.. I didn't know that.
    – user10338659
    Sep 14, 2018 at 14:26
  • Don't rely on this method in a production environment, since your users won't know about caching. Always make sure when updating static files that you also change their name, otherwise your users might not get the new version. You can use the ManifestStaticFileStorage or CachedStaticFileStorage for this purpose.
    – dirkgroten
    Sep 14, 2018 at 15:18
  • Alternatively, make sure S3 sets the caching properties to short period of time (e.g. 10 min) so browsers fetch the newest version at least within this time. This goes at the expense of loading time, since users staying longer on your website will reload existing assets.
    – dirkgroten
    Sep 14, 2018 at 15:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.