heroku+s3+回形针
伙计们, 我在使用 s3 时遇到问题...我正在尝试以这种方式配置 s3 以使用回形针:
has_attached_file :photo,
:storage => :s3,
:bucket => 'gallerybucket',
:styles => { :small => ["150", :png], :large => ["500", :png], :very_large => ['750x500>', :png] },
:path => ":rails_root/public/images/:class/:attachment/:id/:style_:basename.png",
:url => "/images/:class/:attachment/:id/:style_:basename.png",
:default_url => "/images/sem_imagem.gif",
:s3_credentials => {
:access_key_id => ENV['ac'],
:secret_access_key => ENV['sc']
}
但它总是向我显示此错误。我不明白我在这里做错了什么。是否缺少某些配置?
Guys,
I'm having a problem with s3...I'm trying to configure the s3 this way to work with the paperclip:
has_attached_file :photo,
:storage => :s3,
:bucket => 'gallerybucket',
:styles => { :small => ["150", :png], :large => ["500", :png], :very_large => ['750x500>', :png] },
:path => ":rails_root/public/images/:class/:attachment/:id/:style_:basename.png",
:url => "/images/:class/:attachment/:id/:style_:basename.png",
:default_url => "/images/sem_imagem.gif",
:s3_credentials => {
:access_key_id => ENV['ac'],
:secret_access_key => ENV['sc']
}
but it always shows me this error. I don't understand what I'm doing wrong here. Is there some configuration missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您还没有 s3 帐户,请在此处获取一个:
http://aws.amazon.com/s3 /
您需要将其添加到您的联系人模型中:
app/models/contact.rb
确保您的 appname 是您在 Heroku 上的 Rails 应用程序名称。并确保将图片重命名为您为图片命名的名称。
然后你需要一个位于 config/s3.yml 中的配置文件。
确保您获得的密钥和秘密正确。
在您的 gem 文件中,确保安装了这些 gem:
If you don't have an s3 account already go get one here:
http://aws.amazon.com/s3/
You need to add this to your contact model:
app/models/contact.rb
Make sure you appname is your rails app name on heroku. And make sure you rename picture to whatever you have named your picture.
Then you need a config file in
config/s3.yml
.Make sure you get the key and secret correct.
In your gem file make sure you have these gems install :
听起来好像您将变量添加到了 heroku 帐户,但是您是否将它们添加到了 .bashrc 文件中?
然后在您的代码中:
我有一个 博客文章也谈到了这一点。
Sounds like you added the variables to you heroku account, but did you add them to your .bashrc file?
Then in your code:
I have a blog post I wrote that talks about this a little as well.