Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Django Storage Backend systems

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.

like image 574
user3016020 Avatar asked Apr 09 '14 08:04

user3016020


1 Answers

The solution already exists in an app: django-queued-storage

It should handle creating celery tasks that uploads between the storage backends.

like image 79
SmileyChris Avatar answered Oct 27 '22 00:10

SmileyChris