Heroku文件存储 [英] Heroku File Storage
本文介绍了Heroku文件存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
请参阅此博文
在你的
has_attached_file:picture,
:styles => {:大=> 275x450>},
:storage => :s3,
:s3_credentials => #{RAILS_ROOT} /config/s3.yml,
:path => appname /:attachment /:style /:id。:extension
配置目录:
开发:
bucket:bucketname
access_key_id:key
secret_access_key:key
制作:
存储桶:存储桶名称
access_key_id:存储钥匙
secret_access_key:钥匙
然后注册Amazon S3中的存储桶: http:// aws。 amazon.com/s3/
Heroku only has 100MB of file storage, right? I'm making a low-level rails app and I really like Heroku, but if my app allows each user to upload one picture, I may run out of space quickly...is there a simple solution that will allow me to have alternative file storage for profile pics or something of the like?
解决方案
See this blog post
In your model.
has_attached_file :picture,
:styles => {:large => "275x450>"},
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => "appname/:attachment/:style/:id.:extension"
In s3.yml in your config dir:
development:
bucket: bucketname
access_key_id: key
secret_access_key: key
production:
bucket: bucketname
access_key_id: key
secret_access_key: key
Then go signup for a bucket at Amazon S3: http://aws.amazon.com/s3/
这篇关于Heroku文件存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文