I have django application that was using S3BotoStorage backend to store uploaded files on Amazon s3. But in web api services(using django-tastypie) it was taking long time to upload file on s3. As there were request passes through web server and then to amazon s3 storage backend.
So, we come with solution to let them upload first on Web server and implement django-celery tasks through which files get uploaded to amazon s3. It is finished and working. But after that we want to modify the url of files to amazon s3 storage location urls. But when we try to modify file_field_obj.storage to s3botostroage. This gets revert it back to Default File Storage as expected.
So is there any option we can modify Django Models FileField storage field after uploading files on s3. So, in settings there will be DefaultFileStorage pointing to FileSystemStorage. But if files are on s3 then, they will point to s3 storage locations.
The solution already exists in an app: django-queued-storage
It should handle creating celery tasks that uploads between the storage backends.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With