I can set up a storage backend in Django and run collectstatic to generate all static files on my site. This works great. However, I’m wondering if Django provides any mechanism for deleting old static files which are no longer used.
With a simple file-based backend, I could simply use rsync with --delete to deploy the newest files. I’m more concerned about this when using a backend such as S3. One option would be to cycle through containers and delete old containers, but this feels wrong.
Ideally, there would be an rsync-like command I could run which would copy new files and delete unused files for me. (Something like Asset Sync for Rails.)
Alternatively, if I’m asking the wrong question, I welcome other solutions. Thanks!
The answer here is no. I’ve decided just to live with this for now. Coding up a solution for this seems like more effort than it’s worth given how cheap storage is.