部署时,无法加载`Rails.application.database_configuration`无法加载数据库配置。没有这样的文件 -

时间:2019-11-20 15:41:53

标签: ruby-on-rails google-cloud-platform

尝试使用命令gcloud app deploy在Google云端上部署ruby应用程序时出现以下错误,但是当我运行以下命令(在项目目录中)bundle exec unicorn -c config/unicorn.rb时,它可以工作,因此,config/database.yaml文件存在!

错误日志

Step #1: rake aborted!
Step #1: Cannot load `Rails.application.database_configuration`:
Step #1: Could not load database configuration. No such file - 
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/application/configuration.rb:105:in `database_configuration'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb:128:in `block (2 levels) in <class:Railtie>'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:27:in `each'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.6/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.6/lib/active_record/railtie.rb:118:in `block in <class:Railtie>'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `instance_exec'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:30:in `run'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:55:in `block in run_initializers'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/initializable.rb:54:in `run_initializers'
Step #1: /app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.6/lib/rails/application.rb:300:in `initialize!'
Step #1: /app/config/environment.rb:5:in `<top (required)>'
.....
.....
.....

app.yaml

runtime: ruby
env: flex
entrypoint: bundle exec unicorn -c config/unicorn.rb

我做错什么了吗?请告知。

0 个答案:

没有答案