从s3删除对象导致访问被拒绝错误
我的S3 IAM
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*",
"s3-object-lambda:*"
],
"Resource": "*"
}
]
}
字符串
settings.py
INSTALLED_APPS = [
'storages',
]
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
型
django代码
def UpdateCompanyView(request):
user = request.user
company = user.company
old_logo = company.logo
if old_logo and 'logo' in serializer.validated_data and data_logo is not None:
old_logo.delete()
#old_logo.delete(save=False)#I've tried this also
型
其他所有操作工作放,添加,但删除发生此错误
1条答案
按热度按时间zpqajqem1#
你提供的代码是okey,我认为问题是与您的IAM用户我会建议您创建一个新的用户与新的密钥。并将此策略添加到您的桶
字符串