2013-05-02 57 views
0

某些项目资产是ERB(如file.js.coffee.erb),它会从数据库中提取数据以便自行编写。数据库表似乎已经创建好了,但Heroku一直在预编译时停止这样的错误:Heroku中止rake:需要数据库访问时的预编译

could not connect to server: Connection refused 
    Is the server running on host "127.0.0.1" and accepting 
    TCP/IP connections on port 5432? 

好吧,好的。我在Heroku Devcenter中寻找帮助,发现an article解释这实际上是由于环境中缺乏配置变量而发生的。因此,指令是运行:

env RAILS_ENV=production DATABASE_URL=scheme://user:[email protected]/dbname bundle exec rake assets:precompile 2>&1 

于是我运行命令与适当的替代品,从Heroku的tollbelt (Heroku的运行...),外放postgresqlscheme,也填补userpass,和dbname字段正确。一,话又说回来:

rake aborted! 
could not connect to server: Connection refused 
    Is the server running on host "127.0.0.1" and accepting 
    TCP/IP connections on port 5432? 

    (in /app/app/assets/javascripts/file.js.coffee.erb)/app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize' 

好像我是suposed使用从Heroku的自动化数据库配置一些真实的信息,但我只是不知道那些是什么配置。

我有点卡住了。任何人都可以伸出援助之手?

非常感谢!

+0

那么,我通过在本地设置生产环境来进行管理,预编译,然后将其推送到Heroku。到现在为止还挺好。 – 2013-05-02 23:21:16

回答

相关问题