Using Heroku for Django Media Files

后端 未结 2 1774
忘了有多久
忘了有多久 2020-11-29 10:16

On the heroku domain, I am not able to load my Media(Images Saved by using ImageField property) file images. However, I am able to see the images saved in the static field i

2条回答
  •  爱一瞬间的悲伤
    2020-11-29 11:18

    Reason

    Heroku runs your application on dynos and dynos go to sleep after 30 minutes if there is not request comes, this makes Heroku not preserve user upload media files between dynos restart.

    Solution

    Use Amazon S3 service for storing and serving media files + you can also serve static files from S3 also. for documentation refer here.

提交回复
热议问题