Skip to content Skip to sidebar Skip to footer

Why Do Dynamic Images I Uploaded Using Django Admin On A Heroku Deployment Not Showing Up?

I have an e-commerce Django website hosted in Heroku (free acc). I dynamically upload the image and price through the Django admin page. The images were showing up for one day, but

Solution 1:

You can't save (persistantly) media files into Heroku's local filesystem.

The Heroku filesystem is ephemeral - that means that any changes to the filesystem whilst the dyno is running only last until that dyno is shut down or restarted. Each dyno boots with a clean copy of the filesystem 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".

These two facts mean that the filesystem on Heroku is not suitable for persistent storage of data. In cases where you need to store data we recommend using a database addon such as Postgres (for data) or a dedicated file storage service such as AWS S3 (for static files). If you don't want to set up an account with AWS to create an S3 bucket we also have addons here that handle storage and processing of static assets https://elements.heroku.com/addons

Reference: https://help.heroku.com/K1PPS2WM/why-are-my-file-uploads-missing-deleted


Post a Comment for "Why Do Dynamic Images I Uploaded Using Django Admin On A Heroku Deployment Not Showing Up?"