我正在关注Hartl的railstutorial.org并且已经到了11.4.4:生产中的图像上传.我做了什么:
权限: 本教程指示"授予对上一步中创建的用户的读写权限".但是,在存储桶的"Permissons"下,未提及新用户的名称.我只能选择Everyone,Authenticated用户,Log delivery,Me和用户名,亚马逊似乎已经从我的名字+数字创建了自己.我通过选择Authenticated用户并选中上传/删除和查看权限(而不是选择列表和编辑权限)框来尝试它.我也通过选择Everyone并检查所有四个框来尝试它.结果是一样的.
初始化carrier_wave.rb程序设置为以下代码.我已经添加region: 'eu-west-1'到初始化器(我从这里得到的一个想法)去除消息connecting to the matching region will be more performant.
if Rails.env.production?
CarrierWave.configure do |config|
config.fog_credentials = {
# Configuration for Amazon S3
:provider => 'AWS',
:aws_access_key_id => ENV['S3_ACCESS_KEY'], # Set these key's using heroku config:set S3_ACCESS_KEY=<access key>
:aws_secret_access_key => ENV['S3_SECRET_KEY'],
:region => 'eu-west-1'
}
config.fog_directory = ENV['S3_BUCKET']
end
end
Run Code Online (Sandbox Code Playgroud)
错误:
在生产中使用上传器上传图像时,我收到错误We're sorry, but …
ruby ruby-on-rails amazon-s3 amazon-web-services railstutorial.org