[英]Django and Amazon S3
Hi everybody I'm trying to deploy my website and I'm using AWS S3 to store the images that a user upload.大家好,我正在尝试部署我的网站,并且我正在使用 AWS S3 来存储用户上传的图像。 Anyway when I run my website the images don't show up and if I use the inspector I keep having a 404 error.
无论如何,当我运行我的网站时,图像不会显示,如果我使用检查器,我会一直出现 404 错误。 I don't know what I'm doing wrong.
我不知道我做错了什么。 Hope someone can help me, thanks!
希望有人可以帮助我,谢谢!
And if I open the image in another tab I get this:如果我在另一个选项卡中打开图像,我会得到:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>InvalidRequest</Code>
<Message>
The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.
</Message>
<RequestId>6F8B0E05F6191EDA</RequestId>
<HostId>
kwKWtzyw9qjLigGQY/QLLBQjfpVmGDKwlt1fUd4Q1pA+LnZ12prqUri7q1MGpc8oAihXFZU08TA=
</HostId>
</Error>
The bucket region is UE (London) eu-west-2存储桶区域为 UE (London) eu-west-2
This is the CORS configuration I used:这是我使用的 CORS 配置:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>PUT</AllowedMethod>
<AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
In settings.py
, set AWS_S3_SIGNATURE_VERSION
to s3v4
will work.在
settings.py
,将AWS_S3_SIGNATURE_VERSION
设置为s3v4
即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.