Openshift rails 应用程序在 rake:db:load 上没有这样的文件错误

Openshift rails application no such file error on rake:db:load

我在 Openshift 中创建了 RoR 应用程序。克隆到本地机器,一切都很好。但是当我试图将我所做的事情移动到服务器时,包括数据库,在从 app-root/repo 加载我的数据库方案(rake db:scheme:load)时,我得到一个错误:

rake aborted!
Cannot load `Rails.application.database_configuration`:
Could not load database configuration. No such file - 
/var/lib/openshift/54a37ee65973cacb4b000138/app-root/runtime/repo/vendor/bundle/ruby/gems/railties-4.1.4/lib/rails/application/configuration.rb:105:in `database_configuration'
/var/lib/openshift/54a37ee65973cacb4b000138/app-root/runtime/repo/vendor/bundle/ruby/gems/activerecord-4.1.4/lib/active_record/railtie.rb:128:in `block (2 levels) in <class:Railtie>'
/var/lib/openshift/54a37ee65973cacb4b000138/app-root/runtime/repo/vendor/bundle/ruby/gems/activesupport-4.1.4/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
...

还有很多,我都可以提供,只是觉得没必要。

这是我的 database.yml:

development:
  adapter: mysql2
  database: my-database
  username: root
  password: 1234
  host: localhost
test:
  adapter: mysql2
  database: my-database
  username: root
  password: 1234
  host: localhost
production:
  adapter: mysql2
  database: my-database
  username: my-username
  password: my-password
  host: mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/

编辑:刚注意到当我推送我的应用程序时,它的状态堆栈在部署中。也许会有帮助。

尝试将此 database.yml 配置用于您正在使用的任何服务器类型 (https://github.com/openshift/rails4-example/blob/master/.openshift/config/database.yml), and you can also try using this quickstart (https://github.com/openshift/rails4-example),当您执行 [=15] 时,它应该会自动 运行 rake db:migrate =] 推送,这将 运行 为您完成所有迁移并更新您的数据库。

原来我编辑错了database.yml。在我的项目中,我有一个在配置中,一个在 .openshift/config 中。在从头开始的快速启动应用程序中,第一个只包含到第二个的路径,我可能在第一次配置我的数据库时删除了这个字符串。所以把这个字符串放回去,将数据库配置移动到 .openshift 文件夹,就这样,问题解决了。