這是我在終端錯誤上傳照片,錯誤嘗試使用載波和S3
Excon::Error::Socket (getaddrinfo: nodename nor servname provided, or not known (SocketError)):
app/controllers/properties_controller.rb:15:in `create'
這是視圖頁面
getaddrinfo: nodename nor servname provided, or not known (SocketError)
這是我的大霧文件,
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws' # required
config.fog_credentials = {
provider: 'AWS', # required
aws_access_key_id: ENV['AWS_APP_KEY'], # required
aws_secret_access_key: ENV['AWS_APP_SECRET'], # required
region: 'us-east-1', # optional, defaults to 'us-east-1'
host: 's3.example.com', # optional, defaults to nil
endpoint: 's3-external-1.amazonaws.com' # optional, defaults to nil
}
config.fog_directory = ENV['AWS_BUCKET_NAME'] # required
config.fog_public = false # optional, defaults to true
config.fog_attributes = { cache_control: "public, max-age=#{365.day.to_i}" } # optional, defaults to {}
end
任何幫助將不勝感激
def create
@property = Property.new(property_params)
if @property.save
redirect_to root_path
else
render 'new'
end
end
private
def property_params
if params[:property][:amenities].class == Array
params[:property][:amenities] = params[:property][:amenities].join(",")
end
params.require(:property).permit(:property_name, :city, :ppm, :images, :user_id, :amenities, {property_images: []})
end
它要我增加更多的細節,所以我試圖改變區域等等
還做我需要「EXCON」
喜戴夫,你能提供從性能控制器'create'方法? – garythegoat
剛剛添加。謝謝 – Dave
我認爲你需要改變CarrierWave配置選項'主機'指向''s3.amazonaws.com''而不是''s3.example.com'' – garythegoat