[Django]-Changing django-storages backend from from s3 to cloudfiles and dealing with old files

0👍

Option A: You can use a bit different paths on old and new storages and have something to decide from where file should be served. Something could be custom storage class, I think: you create storage class inherited from CloudFilesStorage, and in overrided url method it will either call super (if file is in the new storage) or call url method from S3BotoStorage (if file is in the old storage).

Option B: You can move your files to cloudfiles. I don’t think you actually need to change anything in DB after that if you keep paths similar. Maybe you even don’t need a script, just download files and then upload then (s3cmd can be used for downloading, cloudfiles probably got some tool for uploading too).

About best practices: you should’ve used media_url and DEFAULT_FILE_STORAGE instead of static_url and static storage. It’s a good idea to keep project’s static files (css/js/icons) and uploaded media separated.

Leave a comment