Heroku 和 Carrierwave 不加载我的 s3 配置
我在 Heroku 上有一个应用程序,它使用 Carrierwave gem 将图像上传到 S3。
我已经在名为 Carrierwave.rb 的初始化程序中设置了 s3 配置,
CarrierWave.configure do |config|
config.s3_access_key_id = 'XXXXXXXXXXXXXXXXXXXX'
config.s3_secret_access_key = 'XXXXXXXXXXXXXXXXX'
config.s3_bucket = 'XXXXX'
config.storage = :s3
end
这在我的本地计算机上的开发中工作正常,但是一旦我部署到 Heroku,我会收到以下错误
A Errno::EACCES occurred in events#update:
Permission denied - /app/public/uploads
/usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:243:in `mkdir'
显然它正在尝试写入只读且不选择的 Heroku 服务器调高我的 s3 设置。
有谁知道如何让 heroku 将我的文件发送到 s3?
I have an application on Heroku that uses the Carrierwave gem to upload images to S3.
I have set the s3 configuration in an initializer called carrierwave.rb
CarrierWave.configure do |config|
config.s3_access_key_id = 'XXXXXXXXXXXXXXXXXXXX'
config.s3_secret_access_key = 'XXXXXXXXXXXXXXXXX'
config.s3_bucket = 'XXXXX'
config.storage = :s3
end
This works fine in development on my local machine, however once I deploy to Heroku I get the following error
A Errno::EACCES occurred in events#update:
Permission denied - /app/public/uploads
/usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:243:in `mkdir'
Obviously it's trying to write to the heroku server which is read only and not picking up my s3 settings.
Does anyone know how I can get heroku to send my files to s3?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 CarrierWave wiki:
查看 https://github.com/jnicklas/rierwave/wiki 并滚动到标有“Heroku 上的 CarrierWave”的底部部分,看看他们是如何设置的。希望这对某人有帮助。
From CarrierWave wikki:
Check out https://github.com/jnicklas/carrierwave/wiki and scroll to the bottom section labeled "CarrierWave on Heroku" to see how they set this up. Hope this helps someone.
您看过这个演示应用程序吗?
特别是上传的类此处
Have you looked at this demo app.
In particular the uploaded class here