I am using django-storages with boto. Everything works fine if I let storages handle S3 file uploads in my model as public. However when I set the ACL to private on save/update I get this error message
S3ResponseError: 404 Not Found
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>https:/s3.amazonaws.com/mahbuckit/mods/1366814943/1363379259-re6pc-x-l4d2-the-witch-psd-jpgcopy.zip</Key><RequestId>9631D1222C18F323</RequestId><HostId>bmMgn75bqITigKJWM7L7JrjN2TcsPCslOt9d3LX6WvzxWbHcdBfeqBIdFSZsmhXW</HostId></Error>
This happens on Add/update of record.
This is my save part for the Model where I have FileFIeld. I override to set the acl to private.
def save(self, *args, **kwargs):
super(MyModel, self).save(*args, **kwargs)
if self.file:
conn = boto.connect_s3(settings.AWS_ACCESS_KEY_ID,settings.AWS_SECRET_ACCESS_KEY)
bucket = conn.create_bucket(settings.AWS_STORAGE_BUCKET_NAME)
k = boto.s3.key.Key(bucket)
k.key = settings.MEDIA_URL + self.file.name
k.set_acl('private')
However the file saves all ok. It's the damn errors.