加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 从Heroku建立与Amazon s3的连接

发布时间:2020-12-17 03:18:59 所属栏目:百科 来源:网络整理
导读:我正在尝试在Heroku上部署我的第一个应用程序,并且在使用S3连接时遇到一些麻烦. 这是我从Heroku日志中得到的错误: AWS::S3::CurrentBucketNotSpecified (No bucket name can be inferred from your current connection's address (`s3.amazonaws.com')): 我
我正在尝试在Heroku上部署我的第一个应用程序,并且在使用S3连接时遇到一些麻烦.

这是我从Heroku日志中得到的错误:

AWS::S3::CurrentBucketNotSpecified (No bucket name can be inferred from your current connection's address (`s3.amazonaws.com')):

我有以下配置:

配置/ s3.yml

development:
    bucket_name: dev.myapp.mycompany
    access_key_id: <####>
    secret_access_key: <####>

test:
    bucket_name: test.myapp.mycompany
    access_key_id: <####>
    secret_access_key: <####>

production:
    bucket_name: production.myapp.mycompany
    access_key_id: <####>
    secret_access_key: <####>

项目模型

class Project < ActiveRecord::Base
        has_attached_file :preview,:storage => :s3,:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",:path => "/:style/:filename",:styles => {
          :thumb => "72x44",:small => "312x192"
        }

        has_many :posts,:dependent => :destroy


end

解决方法

配置为:bucket,not:bucket_name

http://docs.heroku.com/s3

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读