Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to mix Django, Uploadify, and S3Boto Storage Backend?
    primarykey
    data
    text
    <h3>Background</h3> <p>I'm doing fairly big file uploads on Django. File size is generally 10MB-100MB.</p> <p>I'm on Heroku and I've been hitting the request timeout of 30 seconds.</p> <h3>The Beginning</h3> <p>In order to get around the limit, Heroku's <a href="http://devcenter.heroku.com/articles/s3#direct_upload" rel="noreferrer">recommendation</a> is to upload from the browser DIRECTLY to S3.</p> <p>Amazon documents this by showing you how to <a href="http://aws.amazon.com/articles/1434" rel="noreferrer">write an <strong>HTML form</strong></a> to perform the upload.</p> <p>Since I'm on Django, rather than write the HTML by hand, I'm using <a href="https://github.com/sbc/django-uploadify-s3" rel="noreferrer">django-uploadify-s3</a> (<a href="https://github.com/sbc/django-uploadify-s3-example" rel="noreferrer">example</a>). This provides me with an SWF object, wrapped in JS, that performs the actual upload.</p> <p>This part is working fine! Hooray!</p> <h3>The Problem</h3> <p>The <em>problem</em> is in tying that data back to my Django model in a sane way. Right now the data comes back as a simple URL string, pointing to the file's location.</p> <p>However, I was previously using <a href="http://django-storages.readthedocs.org/en/latest/backends/amazon-S3.html" rel="noreferrer">S3 Boto from django-storages</a> to manage all of my files as <code>FileFields</code>, backed by the delightful <code>S3BotoStorageFile</code>.</p> <p>To reiterate, S3 Boto is working great in isolation, Uploadify is working great in isolation, the problem is in putting the two together.</p> <p>My understanding is that the only way to populate the <code>FileField</code> is by providing both the <a href="https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.FieldFile.save" rel="noreferrer"><strong>filename</strong> AND the file <strong>content</strong></a>. When you're uploading files from the browser to Django, this is no problem, as Django has the file content in a buffer and can do whatever it likes with it. However, when doing direct-to-S3 uploads like me, Django only receives the file name and URL, not the binary data, so I can't properly populate the <code>FieldFile</code>.</p> <h3>Cry For Help</h3> <p>Anyone know a graceful way to use S3Boto's FileField in conjunction with direct-to-S3 uploading? </p> <p>Else, what's the best way to manage an S3 file just based on its URL? Including setting expiration, key id, etc. </p> <p>Many thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload