With the code from the django-storages you referenced installed
somewhere on PYTHONPATH, its as easy as setting a few things in your
settings.py.  You can see the docs for the code at
http://code.larlet.fr/doc/django-s3-storage.html.  Put the Required
and Optional (if you want it, obviously) stuff in your settings.py and
fill in the appropriate values for your S3 account.

Now, assuming those settings are all correct, all of your FileFields
(and thus, ImageFields) should store to S3 into the bucket you set.
You can continue to use upload_to to prefix the filename within the
bucket.

Now, I've noticed a few bugs, both of which I've notified David (the
author) of:
1) if you call object.filefield.size, this code will download the
entire file from S3 just to calculate the size. This happens because
of the construction of the _open() method on the S3Storage class.  It
should not make the S3 get call (which downloads the file).  The
workaround for now is not to use the size property with this code, but
the more permanent fix is to delay reading of the file from S3 until
read() is called on a S3StorageFile object.
2) I cannot get images to store correctly to S3 when using an
ImageField. They appear in the bucket with a small filesize change,
but no software I have will recognize them as valid images.  Storing
images (and any other file) via a FileField works just fine and the
files are not corrupted.  Strangely, storing images via ImageField on
the FileSystemStorage backend works just fine, so it only seems to be
the combination of an ImageField while using this S3 backend that is
the problem.  I am not sure where the bug in this is.  If you give it
a try, see if you can verify this bug for me.

Jay
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to