Postgresql 在heroku上部署露营应用程序?

Postgresql 在heroku上部署露营应用程序?,postgresql,activerecord,heroku,camping,Postgresql,Activerecord,Heroku,Camping,您好,我想知道如何使用activerecord和postgresql将露营应用程序部署到herokus cedar堆栈上 My database.yml: production: adapter: postgresql host: localhost database: mydb 现在我在连接数据库时遇到问题,我在同一个文件中有一个开发数据库配置 更新: 作为对约翰的回答这里是heroku给我的错误日志 2012-06-15T20:00:24+00:00 app[web

您好,我想知道如何使用activerecord和postgresql将露营应用程序部署到herokus cedar堆栈上

My database.yml:

production:
    adapter: postgresql
    host: localhost
    database: mydb
现在我在连接数据库时遇到问题,我在同一个文件中有一个开发数据库配置

更新: 作为对约翰的回答这里是heroku给我的错误日志

2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:329:in `initialize'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connection'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `connect'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
2012-06-15T20:00:24+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `initialize': could not connect to server: Connection refused (PG::Error)
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
2012-06-15T20:00:24+00:00 app[web.1]:   from /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `loop'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `block in checkout'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/config.ru:12:in `block in <main>'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/config.ru:1:in `<main>'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/src/nuts.rb:8:in `create'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
2012-06-15T20:00:24+00:00 app[web.1]:   Is the server running on host "localhost" and accepting
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `new'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/config.ru:1:in `new'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:241:in `block (2 levels) in checkout'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/model_schema.rb:223:in `table_exists?'
2012-06-15T20:00:24+00:00 app[web.1]:   from (eval):20:in `create_schema'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `<main>'
2012-06-15T20:00:24+00:00 app[web.1]:   TCP/IP connections on port 5432?
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `block in connection'
2012-06-15T20:00:24+00:00 app[web.1]:   from /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `load'
2012-06-15T20:00:24+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:329:in'initialize'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:319:in'checkout\u new\u connection'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:1206:in'connect'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:233:在“签出”中
2012-06-15T20:00:24+00:00应用程序[web.1]:/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:1206:在“初始化”中:无法连接到服务器:连接被拒绝(PG::Error)
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:95:在“connection”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u specification.rb:142:在“connection”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:28:in`postgresql\u connection'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/usr/local/lib/ruby/1.9.1/monitor.rb:201:in'mon_synchronize'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:在“初始化”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:28:in'new'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:236:in'loop'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:236:“签出时阻塞”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in'parse_file'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/config.ru:12:in'block in'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/config.ru:1:in`'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/src/nuts.rb:8:in'create'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:137:在“开始”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in'wrapp'
2012-06-15T20:00:24+00:00应用程序[web.1]:服务器是否在主机“localhost”上运行并接受
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/postgresql\u adapter.rb:1206:in'new'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:309:in'new\u connection'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in'instance_eval'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/config.ru:1:在“new”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:241:在“签出中的块(2层)”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u specification.rb:168:“检索连接”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in'eval'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in'app'
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/model\u schema.rb:223:“表是否存在?”
2012-06-15T20:00:24+00:00应用程序[web.1]:发件人(eval):20:在“创建模式”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in`'
2012-06-15T20:00:24+00:00应用程序[web.1]:端口5432上的TCP/IP连接?
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:404:在“检索连接”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active\u record/connection\u adapters/abstract/connection\u pool.rb:96:in“block in connection”
2012-06-15T20:00:24+00:00应用程序[web.1]:from/usr/local/lib/ruby/1.9.1/monitor.rb:201:in'mon_synchronize'
2012-06-15T20:00:24+00:00应用程序[网站1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:在“开始”中
2012-06-15T20:00:24+00:00应用程序[网站1]:from/app/vendor/bundle/ruby/1.9.1/bin/rackup:19:在“加载”中
2012-06-15T20:00:24+00:00应用程序[web.1]:from/app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/bin/rackup:4:in`'

Heroku将用自己的连接到
数据库URL
环境变量(typi)的database.yml替换您的database.yml