Zorgan
Zorgan

Reputation: 9123

Images from my AWS Bucket not showing on my website

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):

enter image description here

however the image still doesn't work. Any idea why?

Upvotes: 1

Views: 3855

Answers (3)

Stan11
Stan11

Reputation: 284

Add the below in settings.py file

AWS_S3_ADDRESSING_STYLE = "virtual"

Upvotes: 0

NASASIRA
NASASIRA

Reputation: 1

Add this in your settings.py file:

AWS_QUERYSTRING_AUTH = False

Upvotes: 0

Alexei Zababurin
Alexei Zababurin

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

Related Questions