I recently connected my Django app to Digital Ocean Spaces using the django-storages
library, and suffice it to say I have a lot of static files (currently 2545 files, most of which are small-ish audio files).
I just timed how long it took python3 manage.py collectstatic
to run to copy a single static file, and it took 3 minutes 27 seconds. This was the output:
USER@computer dirName % python3 manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings.
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
1 static file copied, 2544 unmodified.
Is there a way to speed the collectstatic
process up? Can I tell it which files to collect and copy? Can it somehow interface with git to know which ones to collect and copy?
I would try using Collectfasta
.
The issue is that collectstatic
was originally built for use on the local disk, back before cloud storage was mainstream.
Jason Giancono, the author of Collectfasta
, wrote a detailed article describing the issue.