0
我的问题是,当部署到Heroku DataMapper试图使用这部分我的数据库连接信息'postgres://postgres:[email protected]/recall'
当我有DataMapper.setup(:default, ENV['DATABASE_URL'] || 'postgres://postgres:[email protected]/recall')
作为我的完整数据库连接。使用开发数据库而不是ENV ['DATABASE_URL']的Heroku上的DataMapper连接?
这是我的Heroku的日志文件:
2012-07-08T06:49:40+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 26035`
2012-07-08T06:49:48+00:00 app[web.1]: Is the server running on host "localhost" and accepting
2012-07-08T06:49:48+00:00 app[web.1]: from <internal:prelude>:10:in `synchronize'
2012-07-08T06:49:48+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/connection.rb:79:in `initialize': could not connect to server: Connection refused (DataObjects::ConnectionError)
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:177:in `block in new'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:172:in `new'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/connection.rb:79:in `new'
2012-07-08T06:49:48+00:00 app[web.1]: TCP/IP connections on port 5432?
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:251:in `open_connection'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/connection.rb:68:in `new'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:119:in `new'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-transactions-1.2.0/lib/dm-transactions/adapters/dm-do-adapter.rb:69:in `open_connection'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:61:in `execute'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:60:in `ensure in without_notices'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:60:in `without_notices'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:18:in `upgrade_model_storage'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:73:in `upgrade_model_storage'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:47:in `block in repository_execute'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:145:in `auto_upgrade!'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/descendant_set.rb:64:in `block in each'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/ordered_set.rb:319:in `each'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/ordered_set.rb:319:in `block in each'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/subject_set.rb:210:in `block in each'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/ordered_set.rb:319:in `each'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/subject_set.rb:210:in `each'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/descendant_set.rb:63:in `each'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:46:in `repository_execute'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:27:in `auto_upgrade!'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/recall.rb:25:in `<top (required)>'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/config.ru:2:in `require'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/config.ru:2:in `block in <main>'
2012-07-08T06:49:48+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-07-08T06:49:48+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-07-08T06:49:48+00:00 app[web.1]: from /app/config.ru:1:in `new'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/config.ru:1:in `<main>'
2012-07-08T06:49:48+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-07-08T06:49:48+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-07-08
T06:49:48+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-07-08T06:49:48+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-07-08T06:49:48+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-07-08T06:49:48+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-07-08T06:49:48+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-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `load'
2012-07-08T06:49:48+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `<main>'
“CYAN”部分只是该数据库随机命名的颜色属性 - 可能是NAVY或GREEN等。你应该使用DATABASE_URL。如果DATABASE_URL不可用,那么您还没有添加数据库加载项。 – catsby 2012-12-12 15:08:08
已投票..对我有帮助。 – 2014-12-21 09:46:26