boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden

后端 未结 9 1191
感情败类
感情败类 2020-11-29 19:13

I\'m trying to get django to upload static files to S3, but istead I\'m getting a 403 forbidden error, and I\'m not sure why.

Full Stacktrace:

9条回答
  •  误落风尘
    2020-11-29 19:38

    I would recommend that you try to test your AWS credentials separately to verify whether the credentials do actually have permission to read and write data to the S3 bucket. The following should work:

    >>> import boto
    >>> s3 = boto.connect_s3('', '')
    >>> bucket = s3.lookup('donebox-static')
    >>> key = bucket.new_key('testkey')
    >>> key.set_contents_from_string('This is a test')
    >>> key.exists()
    >>> key.delete()
    

    You should try the same test with the other bucket ('donebox-media'). If this works, the permissions are correct and the problem lies in the Django storages code or configuration. If this fails with a 403 then either:

    • The access_key/secret_key strings are incorrect
    • The access_key/secret_key are correct but that account doesn't have the necessary permissions to write to the bucket

    I hope that helps. Please report back your findings.

提交回复
热议问题