Django and Heroku Static Image Files Disappearing

904 views
Skip to first unread message

That guy

unread,
Jan 10, 2013, 4:14:19 PM1/10/13
to django...@googlegroups.com

Hi there :)

On heroku, do static images expire after some point and automatically get deleted?

My situation is that I retrieve images from my PostgreSQL database through a model's ImageField by setting its upload_to equal to static/images. Then, I access the images through mysitesurl.com/static/images/model.url This works perfectly initially. However, after several hours, what I notice is that the images are no longer accessible. When I try to access them through the same url, they no longer exist. I do not do any manual image deletions so the operations I perform should not interfere with this.

Is this something that Heroku does that I do not understand?

Also, one odd occurrence that I notice is that the image is still accessible through the url, but it doesn't actually get saved to static/images. When I run the bash shell provided by heroku, its not in the static folder.

Note: I am aware of S3, but I am trying to get this to work purely on Heroku.

Thanks for any help :D

Filip Wasilewski

unread,
Jan 10, 2013, 10:00:33 PM1/10/13
to django...@googlegroups.com
Hi,

On Thursday, January 10, 2013 10:14:19 PM UTC+1, That guy wrote:

Hi there :)

On heroku, do static images expire after some point and automatically get deleted?

Heroku dyno file system is not persistent between restarts and you have to store your media files outside of Heroku - https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem. Just use django-storages with a cloud storage.

Filip

Reply all
Reply to author
Forward
0 new messages