4

Is there a way to make python manage.py collectstatic find updated static files? Currently, it is properly searching STATICFILES_DIRS and finding where I have my static files, but it only uploads new ones. If I modify a static file, it does not detect this. Does Django do this so we have to delete each file first, or is there an easy solution?

Joker
  • 2,119
  • 4
  • 27
  • 38
  • 2
    It by default looks for new and modified files. – Aamir Rind Jun 11 '13 at 07:48
  • I don't believe I changed any of the defaults, and I am not using any specific flags when calling collectstatic. It still is finding new files, but is not detecting changes to my CSS files, and most likely my other static files. – Joker Jun 11 '13 at 08:08
  • And try to use python manage,py collecstatic -n – Roberth Solís Apr 29 '16 at 04:06

1 Answers1

4

UPDATE:

Disclaimer - This issue has to do with external hosting on Amazon's S3 Storage

I had simply forgot to include AWS_PRELOAD_METADATA = True in my settings.py file. Adding this setting in fixed the issue of collectstatic only finding new files. Also, I saw a major speed increase in syncing between the server and Amazon's S3.

If you are using S3 for storage, I found this answer to be quite helpful.

Community
  • 1
  • 1
Joker
  • 2,119
  • 4
  • 27
  • 38
  • I'm havin the same issue, and while changing that setting did seem to speed things up, it still didn't detect some modified files. Any other ideas on why collectstatic wouldn't find updated files? – jkeesh Dec 07 '13 at 22:32
  • `AWS_PRELOAD_METADATA ` is now [deprecated](https://github.com/jschneier/django-storages/issues/293). If you have a S3 bucket with many files this setting would cause a server to attempt to load a list of all those files and slow down, or in my case crash. – petroleyum Dec 07 '18 at 00:26