本地一切都按预期工作,我使用:文件存储,它正在工作。
但我部署的版本使用:雾存储,它无法正常工作。每次我尝试上传图片时都会遇到以下错误:
Permission denied - /mnt/foo/releases/20130607190757/public/uploads
我的上传器配置如下:
class ImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
我的初始化程序定义如下:
CarrierWave.configure do |config|
unless Rails.env.test?
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
config.fog_directory = Rails.configuration.fog_directory
config.fog_public = false
end
if Rails.env.test? or Rails.env.cucumber?
config.enable_processing = false
config.storage = :file
# We may want to changes storage to 'file' after initial testing
elsif Rails.env.development?
config.storage = :file
elsif Rails.env.staging? or Rails.env.pilot? or Rails.env.production?
config.storage = :fog
end
end
任何人都知道导致该错误的原因是什么?它看起来像是作为文件存储,因为它显示了整个文件的路径。
此致
答案 0 :(得分:0)
尝试将权限扩展到此文件夹
答案 1 :(得分:0)
我发现问题是我在橡胶部署期间没有创建文件夹。创建文件夹后,我能够完成部署。