2

Note: I am using Rails 3.2.13 and Ruby "1.9.3", and postgres-0.15.1

I tried to push my Ruby on Rails app in to heroku by following the procedure this website http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec-deploying , but I got error while try to push into heroku

   Connecting to database specified by DATABASE_URL
   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?
 !     Precompiling assets failed.
 !     Push rejected, failed to compile Ruby app

To git@heroku.com:pure-hamlet-9148.git
 ! [remote rejected] master -> master (pre-receive hook declined)

So, I Googled myself and run the below command

heroku labs:disable user-env-compile
heroku labs:enable user-env-compile

Still getting the same error, please some help me to resolve this issue.

4

3 回答 3

3

随着西蒙娜的回答,

在部署之前,请按照此网站在本地预编译您的资产。https://devcenter.heroku.com/articles/rails-asset-pipeline

RAILS_ENV=production bundle exec rake assets:precompile
git add public/assets -f
git commit -m "vendor compiled assets"
于 2013-12-13T14:24:13.290 回答
2

查看这篇关于Heroku 和 Rails 资产的文章:预编译错误。你应该设置

config.assets.initialize_on_precompile = false
于 2013-12-13T13:35:38.793 回答
0

解决此错误的方法:首先设置 DATABASE_URL 环境变量,然后再次尝试将代码推送到 Heroku。它就像在 Heroku 端完成的所有 rake 编译一样工作,因此不再连接到本地机器进行 rake 编译 @ .../tmp/bin..... 目录。

于 2015-02-01T06:01:28.503 回答