Reputation: 11
I have configured django to use s3 to hold media files. I can from the application upload files and they are stored on the s3, however if i try to view these media files i get this error.
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your key and signing method.
</Message>
I know GET requests are enabled as I can use Postman to get the images using the same credentials. So I'm not entirely sure whats wrong.
STATIC_ROOT = os.path.join(BASE_DIR, '/staticfiles/')
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, '/image_library/')
MEDIA_URL = '/media/'
AWS_ACCESS_KEY_ID = 'PLACEHOLDER'
AWS_SECRET_ACCESS_KEY = 'PLACEHOLDER'
AWS_STORAGE_BUCKET_NAME = 'childcaredevapp'
AWS_DEFAULT_ACL = None
AWS_S3_FILE_OVERWRITE = False
AWS_S3_SIGNATURE_VERSION = "s3v4"
AWS_S3_REGION_NAME = 'eu-central-1'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
Upvotes: 1
Views: 773
Reputation: 2068
I faced this error, I solve it by adding the AWS_S3_ADDRESSING_STYLE variable:
AWS_S3_ADDRESSING_STYLE = "virtual"
Upvotes: 0
Reputation: 66
So... Long story short, i achieved it to create correct signature by removing AWS_S3_SIGNATURE_VERSION = "s3v4"
line. Looks like they dont match for some reason.
Upvotes: 2