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

ruby – 在Heroku上没有这样的文件’config / database.yml’

发布时间:2020-12-17 02:19:04 所属栏目:百科 来源:网络整理
导读:我的应用程序是一个 Ruby机架应用程序当我的Heroku应用程序启动它会因为而中断 /app/config.ru:8:in `read’: No such file or directory – config/database.yml (Errno::ENOENT) 为什么会这样?我知道Heroku意在创建这个文件https://devcenter.heroku.com/
我的应用程序是一个 Ruby机架应用程序当我的Heroku应用程序启动它会因为而中断

/app/config.ru:8:in `read’: No such file or directory – config/database.yml (Errno::ENOENT)

为什么会这样?我知道Heroku意在创建这个文件https://devcenter.heroku.com/articles/cedar-migration

The database credentials will still be configured automatically: at slug compile time,a config/database.yml that parses the DATABASE_URL from the environment will be written into the app.

令人沮丧的是,https://devcenter.heroku.com/articles/ruby的文档没有解释database.yml

解决方法

好的,第一件事 – heroku不使用database.yml文件.默认情况下,rails app会自动从config /目录加载它.并且无需在config.ru中手动加载它.如果你想在heroku PosgreSQL中使用 – 只需添加附加组件. Heroku会做所有其他事情来链接你的应用程序和数据库.如果要使用外部MySQL服务器,则应使用Amazon RDS附加组件

heroku addons:add amazon_rds url=mysql2://user:pass@dbhost/dbname

通过这个你可以使用任何数据库.我通过Amazon RDS附加组件使用GoDaddy mysql库.

无论如何,你的config.ru第8行的问题就像

read 'config/database.yml'

删除它并查看与heroku不冲突的其他方法

祝好运

(编辑:李大同)

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

    推荐文章
      热点阅读