0

我第一次尝试将我的 Rails 应用程序部署到 heroku 上。我在 Windows 8 上使用 Rails 3.2.11 和 ruby​​ 1.9.3。我一直在寻找答案,但没有成功。我一直遵循heroku 的入门教程,直到它告诉你推送。

git push heroku master

这给了我以下错误:

-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins!
Support for these plugins will be removed in Rails 4.0. Move them out and bundle
them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/
initializers/myplugin.rb. See the release notes for more on this: http://weblog.
rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at          
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins!  
Support for these plugins will be removed in Rails 4.0. Move them out and bundle
them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/
initializers/myplugin.rb. See the release notes for more on this: http://weblog.
rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at     
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/Rakefile:7)
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?
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapte
r.rb:1208:in initialize'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapte
r.rb:1208:innew'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapte
r.rb:1208:in connect'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapte
r.rb:326:ininitialize'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapte
r.rb:28:in new'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapte
r.rb:28:inpostgresql_connection'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:315:in new_connection'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:325:incheckout_new_connection'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:247:in block (2 levels) in checkout'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:242:inloop'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:242:in block in checkout'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:239:incheckout'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:102:in block in connection'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:101:inconnection'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_pool.rb:410:in retrieve_connection'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_specification.rb:171:inretrieve_connection'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connecti
on_specification.rb:145:in connection'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/model_schema.rb:308:inclear_cache!'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activerecord-3.2.11/lib/active_record/railtie.rb:97:in block (2 levels) in
<class:Railtie>'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418:in_run__35780770
63533031320__prepare__2058969196489290367__callbacks'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in __run_callback
'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in_run_prepare_c
allbacks'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in run_callbacks'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:74:inprepare
!'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:48:in prepare
!'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/application/finisher.rb:47:inblock in '
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/initializable.rb:30:in instance_exec'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/initializable.rb:30:inrun'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/initializable.rb:55:in block in run_initializers
'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/initializable.rb:54:ineach'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/initializable.rb:54:in run_initializers'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/application.rb:136:ininitialize!'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in method_missing'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/config/environment.rb:5:i
n'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:inblock in re
quire'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/v
gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in load_depend
ency'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:inrequire'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/application.rb:103:in require_environment!'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/railties-3.2.11/lib/rails/application.rb:297:inblock (2 levels) in initia
lize_tasks'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/actionpack-3.2.11/lib/sprockets/assets.rake:93:in block (2 levels) in <top
(required)>'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/actionpack-3.2.11/lib/sprockets/assets.rake:60:inblock (3 levels) in '
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/actionpack-3.2.11/lib/sprockets/assets.rake:23:in invoke_or_reboot_rake_ta
sk'
/tmp/build_7255e9b5-d3d1-4b02-adaf-b98a0f6b4528/vendor/bundle/ruby/2.0.0/
gems/actionpack-3.2.11/lib/sprockets/assets.rake:29:inblock (2 levels) in '
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
To git@heroku.com:myapp.git
!     [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:myapp.git'

我还尝试使用以下方法预编译资产:

bundle exec rake assets:precompile

它会在我的 public/assets 目录中生成一个 manifest.yml 文件。我已经提交了那个文件。因此,它根本不应该按照我看过的教程来尝试预编译文件。为什么它忽略了我的 manifest.yml 文件?

请让我知道我能做什么。我想不明白。

谢谢!

4

1 回答 1

1

好的,我很接近。被 Rails 3.2.x 抛弃了——这些天我用的是 4.0.x。

来自 Heroku 文档:

在预编译资产时,在 Rails 3.x 中,您可以通过确保以下行位于 config/application.rb 中来防止初始化应用程序并连接到数据库:

config.assets.initialize_on_precompile = false
于 2013-11-04T06:22:26.557 回答