collectstatic should support checksums as method to determine a file's changed state
|Reported by:||dloewenherz||Owned by:||dloewenherz|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When running ./manage.py collectstatic, all files in all static directories are copied to the location specified by STATICFILES_STORAGE, regardless of whether they have already been copied or not.
I propose that collectstatic should only copy files to the destination if they have changed or don't yet exist. I wrote my own solution which doesn't incorporate staticfiles, but I'd like to see this in Django proper. Without this feature, it can take ages to upload static media for a large project. It makes sense to only update those assets which have changed between deploys.
I currently solve this problem by creating a file containing metadata of all the static media at the root of the destination. This file is a JSON object that contains file paths as keys and checksum as values. When an upload is started, the uploader checks to see if the file path exists as a key in the dictionary. If it does, it checks to see if the checksums have changed. If they haven't changed, the uploader skips the file. At the end of the upload, the checksum file is updated on the destination.
Change History (7)
comment:1 Changed 22 months ago by anonymous
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 22 months ago by aaugustin
- Resolution set to needsinfo
- Status changed from new to closed
comment:3 Changed 22 months ago by dloewenherz
comment:5 Changed 22 months ago by dloewenherz
- Resolution needsinfo deleted
- Status changed from closed to reopened
comment:7 Changed 21 months ago by ptone
- Resolution set to wontfix
- Status changed from reopened to closed
- Summary changed from collectstatic should only copy files if they have changed or don't exist in destination to collectstatic should support checksums as method to determine a file's changed state