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?
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?