Lutaaya Huzaifah Idris
Lutaaya Huzaifah Idris

Reputation: 3990

Can't access images via web with Azure storage and Django

I want to access the path of the image/blog in the browser, I am using Django rest API and the package Azure storage, I tried to make the container storage public, but still had no luck in accessing the image, what could be wrong?

This is an example of the image I want to access, it's there in the storage but can't access it :

https://gu-stagineis.net/media/blog_images/images_3.jpeg

Upvotes: 0

Views: 542

Answers (1)

Mohit Ganorkar
Mohit Ganorkar

Reputation: 2069

  • If you store your images in a container of a storage account and grant public to the container then you can access the images using a URL.

  • First create a container under the Containers tab in the storage and then set the access level to container . enter image description here

  • Now click on the newly created container and then click on upload and upload images in the container .

enter image description here

  • Here I have uploaded two images If you click on the images a pop will immerge with the url of the that image enter image description here

  • This url is publicly accessible and you can make get request to it in you django app

In Browser : enter image description here

In Postman : enter image description here

  • you don't even need to go the storage account for url

the urls will be of format :

https://<Storage Acount Name>.blob.core.windows.net/<Container>/<Image Name>

@Siddhartha Vikram answer is also correct using the azure storage.blob

Upvotes: 1

Related Questions