jazzband / django-queued-storage

Provides a proxy for Django storage backends that allows you to upload files locally and eventually serve them remotely
http://django-queued-storage.rtfd.org/
BSD 3-Clause "New" or "Revised" License
317 stars 62 forks source link

strange behavior of queued-storage for boto? #1

Closed kuno closed 13 years ago

kuno commented 13 years ago

I just followed the example on this page, http://django-queued-storage.readthedocs.org/en/latest/fields.html <=============================================== from queued_storage.backends import QueuedS3BotoStorage from queued_storage.fields import QueuedFileField

class MyModel(models.Model): image = QueuedFileField(storage=QueuedS3BotoStorage(delayed=True))

my_obj = MyModel(image=File(open('image.png')))

my_obj.save()

my_obj.image.transfer() ===================================================================>

At first, everything gose well, but when I tried the local save <============================================== my_obj.save() ===============================================>

It threw out a exception: <================================================ S3ResponseError: S3ResponseError: 403 Forbidden =================================================>

After some research, I realized that the boto library just try to use the name of image field (my_obj.image.name, in this case) as a key-name to lookup the corresponding key in s3 server. Because the local file have not been uploaded to s3, off course, you can not find this key in s3. Then s3 return a 403 forbidden response.

This is a very strange behavior, and I am not sure which library caused this behavior. Any suggestion?

kuno commented 13 years ago

Sorry, this is caused by miss spelling of myself... closed.