Monday, January 27, 2014

Re: Dyanmically changing Django Storage?

you can define the storage for each FileField when declaring your model, it will use the default unless you specify something else.
Does your use case have the same model using different storages?
I suggest you make different models, each using the storage you want, 
Lets say you have two models, S3File and LocalFile
when uploading the file you then decide if it is a S3File object or a LocalFile object


On Mon, Jan 27, 2014 at 10:19 PM, Javier Guerra Giraldez <javier@guerrag.com> wrote:
On Mon, Jan 27, 2014 at 3:07 PM, zweb <ashish8job@gmail.com> wrote:
> During run time, based on file size and type,  I want to use a different
> storage backend. How to do it?


write a storage backend proxy that picks which 'real' backend to use
for each file.

note that during upload, you have to start storing before knowing the
full size of the file.

--
Javier

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFkDaoRxkzGb1z3uLt%2B6WzFoKpgq6F05c7xdH9cqqLMhfHof8w%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6tLouA62Qb9_NPf%2BjU%2B-Cb-zVb1x2y9XBaQ98rnZ9f9FGg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment