Hi, Chris, Were you able to get this working? I'm in the same situation.
I am able to directly upload my files to S3 using S3Upload.js (https://groups.google.com/forum/#!searchin/django-users/s3$20django-storages/django-users/5ltaK8NQ_lw/6hGtCE-oqH8J) and Will's code (https://github.com/flyingsparx/FlaskDirectUploader). I don't want to resend my files (user computer -> Heroku -> S3) since I already have them on S3. I have django-storages set up because I need to generate thumbnails, and I need access to S3 to upload videos from S3 (to Heroku) to Vimeo. So my question is 1) do I not submit the uploaded files by not placing them within the <form> html tags, 2) do I submit the files to Heroku but not do anything to these files? 3) Do I take the full URL path of my files stored on S3 and save that full url path as a string to my FileField and ImageField attributes in my model? Please let me know. Thanks well in advance. - Rise On Thursday, January 5, 2012 8:11:15 PM UTC-8, Chris Hasenpflug wrote: > > The reason I'm POSTing after the direct upload to S3 I need to create > the model with extra data. As far as I can tell S3's > success_action_redirect doesn't allow you to pass additional > information. > > Additionally, since this is an ImageField, I can't set the key > directly. At the moment, I've resorted to Raw SQL :( What have I > missed? > > On Jan 1, 3:45 pm, Ivo Brodien <[email protected]> wrote: > > Hi, > > > > the form sends the picture to S3 and then S3 calls you on an URL which > you specify with “ success_action_redirect”. This should point to an URL on > your server where you then store the key/hash which will be provided in the > URL. > > > > Your code uses POST data but S3 will put the metadata in the URL (=GET) > (bucket, key and etag) > > > > So just make sure that your forms posts to S3 and you define the > success_action_redirect URL. > > > > I think you actually don’t need the S3StorageBackend since you are not > storing anything or at least it does not actually pass your server. > > > > hope that helps! > > > > Cheers > > Ivo > > > > On Jan 1, 2012, at 12:25 , 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 post to this group, send email to > > > [email protected]<javascript:>. > > > > To unsubscribe from this group, send email to > [email protected] <javascript:>. > > > For more options, visit this group athttp:// > groups.google.com/group/django-users?hl=en. -- 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 [email protected]. To post to this group, send email to [email protected]. 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/1836303c-bc2f-4d33-b9d1-74984a74a55c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

