Blog Details

How to set cloudinary API for media storage

The first time I host Django website on cloud platform as a service (PaaS) called Heroku I used whitenoise for static files (CSS, JavaScript, Images) like the documentation describes it. So I started to add contents on hosted website and also upload some images but after while I return back to that website and all images I was uploaded were deleted so I started the way of figuring out why and what can I do? and I found an article on Heroku said why are my file uploads missing/deleted after short time reading it I figured out that the problem was the following.

Heroku file system is ephemeral - that means that any changes to the file system whilst the dyno is running only last until that dyno is shut down or restarted. Each dyno boots with a clean copy of the file system from the most recent deploy. This is similar to how many container based systems, such as Docker, operate. In addition, under normal operations dynos will restart every day in a process known as Cycling So due to that problem they suggest me to use S3 bucket but I was still student I didn't have credit card for verifying my account on (Amazon Web Services) AWS. In my way of figuring out what can I do I found cloud storage called Cloudinary this cloud storage provides an API for uploading images, videos, and any other kind of file to the cloud. and it allow secure uploading from your servers, directly from your visitors' browsers or mobile applications, or fetched via remote public URLs.

So without being said let give out the steps but before getting started let's assume that you have Django website which uploads images to the server and render it out dynamically.

1. Create an account on cloudinary Sign up for free here


Comments (3)

  • Eric

    May 23, 2021

    Nice blog

    Reply
  • Dushimimana_Fabrice

    Aug. 29, 2021

    I have faced with the same problem a couple of times until I found this amazing and helpful blog on this website..... Umutambyi gad is life saver!!!

    Reply
  • Peace_Cyebukayire

    Sept. 22, 2021

    Wow:) This helped. Thanks Gad

    Reply

Leave a Comment