簡體   English   中英

Django 和 Amazon S3

[英]Django and Amazon S3

大家好,我正在嘗試部署我的網站,並且我正在使用 AWS S3 來存儲用戶上傳的圖像。 無論如何,當我運行我的網站時,圖像不會顯示,如果我使用檢查器,我會一直出現 404 錯誤。 我不知道我做錯了什么。 希望有人可以幫助我,謝謝!

如果我在另一個選項卡中打開圖像,我會得到:

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>

存儲桶區域為 UE (London) eu-west-2

這是我使用的 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>

settings.py ,將AWS_S3_SIGNATURE_VERSION設置為s3v4即可。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM