django 存储 AWS S3 SigVer4:SignatureDoesNotMatch

django storages AWS S3 SigVer4: SignatureDoesNotMatch

我的配置(非常基础):


        settings.py
        AWS_S3_REGION_NAME = 'eu-west-3'
        AWS_S3_FILE_OVERWRITE = False
        # S3_USE_SIGV4 = True # if used, nothing changes
        # AWS_S3_SIGNATURE_VERSION = "s3v4" # if used, nothing changes
        AWS_ACCESS_KEY_ID = "xxx"
        AWS_SECRET_ACCESS_KEY = "xxx"
        AWS_STORAGE_BUCKET_NAME = 'xxx'
        # AWS_S3_CUSTOM_DOMAIN = f'{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com'  # if used, no pre-signed urls
        AWS_DEFAULT_ACL = 'private'
        AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400'}
        AWS_LOCATION = 'xxx'
        DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
        
        INSTALLED_APPS = [
           ...,
           'storages'
        ]
        
        models.py
        class ProcessStep(models.Model):
            icon = models.FileField(upload_to="photos/process_icons/")

我得到的:

  1. 预签名 url 已生成(在 icon.url 和管理页面上自动生成)
  2. 预签名url响应状态代码=403(禁止)
  3. 如果打开,SignatureDoesNotMatch错误。带文字:The request signature we calculated does not match the signature you provided. Check your key and signing method.

尝试过:

意见:

问题:

  1. 我该怎么办?
  2. 为什么我会收到错误消息?

耐心是一种美德!

一个人可能需要等待 1 天才能正常工作