Errno::ENOENT(没有这样的文件或目录@ rb_sysopen - aws.yml)在 rails 中带有回形针

Errno::ENOENT (No such file or directory @ rb_sysopen - aws.yml) in rails with paperclip

Rais 应用程序部署在 aws elastic beantalk 中。图像未从资产文件夹加载。我正在尝试使用 s3 存储桶来存储资产。我收到一个错误...

aws.yml

 production:
  access_key_id: 123333231331....
  secret_access_key: 12212dddddd........

production.rb

  config.paperclip_defaults = {
  :storage => :s3,
  :preserve_files => true,
  :s3_credentials => 'aws.yml',
  :s3_region => 'ap-south-1',
  :s3_host_name => 's3.ap-south-1.amazonaws.com',
  :bucket => 'xxxxxx'
}

我还在 s3 存储桶中授予 public 访问权限。

anyone: read write

gem...

gem 'aws-sdk', '~> 2.10', '>= 2.10.85'
配置文件夹中的

aws.yml 文件夹 -- config/aws.yml

您是否尝试过使用文件路径,如问题底部所示::s3_credentials => 'config/aws.yml'.

否则,您可能需要从 YAML 显式加载文件并将其传入:

require 'yaml'
...
# again, perhaps using config/aws.yml, have a play
:s3_credentials => YAML.load_file('aws.yml')
...

这些都有帮助吗?