我推送到heroku后,媒体文件消失了 [英] Media files disappear after i push to heroku

查看:70
本文介绍了我推送到heroku后,媒体文件消失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的Django项目,用户可以更新图像,并且图像存储在/images 目录中,这是我对此的设置部分:

I've created a new Django project that users can update images, and the images are being stored in /images dir, here is my setting part about it :

MEDIA_ROOT = os.path.join(BASE_DIR,'images/')
MEDIA_URL = '/Images/'

这是我与Heroku一起使用的数据库设置部分

and here is the DB setting part I am using with Heroku

DATABASES['default'] = dj_database_url.config(conn_max_age=600, ssl_require=True)
SQL_ALCHEMY_DATABASE_URI = os.environ['DATABASE_URL']

这是网站 https://fostania-web-app.herokuapp.com/,您可以看到它是我每次按下都会失败的图像滑块.

here is the website https://fostania-web-app.herokuapp.com/, u can see it the image slider that fails every time I push.

关于此的任何建议!?

推荐答案

发现我只需要使用云存储服务,因为Heroku无法保存文件...我选择了Amazon Web服务.分步指南:如何使用django设置Amazon S3

Found out that I just needed to use a cloud storage services because Heroku can't save files ... I picked Amazon web services .. here is a good step by step guide : How to setup Amazon S3 with django

这篇关于我推送到heroku后,媒体文件消失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆