Reputation: 9123
I've implemented AWS S3 storage to my Django project. So I just uploaded all my static images to my bucket. However it is not showing up on my site. My HTML for the images are the standard Django syntax for template:
<img src="{% static 'images/settingsIcon.png' %}">
The img
src
appears to point to the correct URL (the image in my bucket):
however the image still doesn't work. Any idea why?
Upvotes: 1
Views: 3855
Reputation: 284
Add the below in settings.py
file
AWS_S3_ADDRESSING_STYLE = "virtual"
Upvotes: 0
Reputation: 957
You need to change Content-Type of the uploaded file 'ContentType' =>'image/jpeg'. And, also you need to turn off Block public access.
const uploadFile = new aws.S3.ManagedUpload({
params: {
...uploadParams,
ContentType: 'image/jpeg',
Key: file.name,
Body: fileUploadStream,
},
});
Upvotes: 1