Monday, November 27, 2017

Re: Skip upload of existing S3 Object

Hi Chris,
Were you able to solve this? I am in a similar situation.

On Sunday, January 1, 2012 at 4:55:07 PM UTC+5:30, Chris Hasenpflug wrote:
I have a model with an ImageField and am using django-storages
S3BotoStorage backend. To reduce load on the server, I'm using
Amazon's S3 Browser Upload functionality[1] to send images directly to
S3. In order to create the model, my plan is have another view take
the uploaded key and save a model instance of my image.  Currently my
view code looks something like this:

def add_existing_image(request):
    ...
    image_key = request.POST.get('image_key', None)
    im = default_storage.open(image_key)
    i = Image(image=im, owner=user)

However, this seems to re-save the image on S3. I was hoping that
since I'm not directly reading the file it would not need to do so
behind the scenes, but it is. Since the goal is to not incur that
overhead, how should I go about creating model instances of these
files that already exist in my storage?

[1] http://aws.amazon.com/articles/1434

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c7582b55-7175-4dae-8612-a7fd3ab4a949%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment