【发布时间】:2023-04-05 20:13:01
【问题描述】:
我今天在 heroku 上运行 padrino (0.11.2) 应用程序时遇到问题。我回来的错误表明连接 URL 不起作用,例如
2013-06-20T12:55:59.040527+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:12:in `new': +options+ should be Hash or Addressable::URI or String, but was NilClass (ArgumentError)
但是直到我阅读了这篇文章 (https://devcenter.heroku.com/articles/config-vars) 并检查了我的环境变量,即在控制台上,我才发现问题出在哪里:
> heroku config
=== myapp Config Vars
HEROKU_POSTGRESQL_COBALT_URL: postgres://blah blah blah...
注意到这一点,我将 database.db 中的 DATABASE_URL 常量更改为 HEROKU_POSTGRESQL_COBALT_URL,然后一切正常。文档过时了吗?例如:
- https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-ruby
- http://www.padrinorb.com/guides/blog-tutorial
有些事情发生了变化,还是我在某个地方搞砸了? - 我注意到在部署应用程序时,heroku 会自动编写一个 database.yml 文件,但我认为 padrino 不会使用它。
【问题讨论】:
标签: postgresql heroku padrino