我想第一次將我的Rails應用程序部署到heroku上。我在Windows 8上使用Rails 3.2.11和ruby 1.9.3。我一直在尋找很長時間來回答問題,但一直沒有成功。我一直沿着heroku's tutorial開始,直到它告訴你推。第一次無法將rails應用程序部署到heroku;忽略manifest.yml文件
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 [email protected]:myapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:myapp.git'
我也試着預編譯資產產生使用:
bundle exec rake assets:precompile
這在我的公共/租入資產價值產生manifest.yml文件目錄。我已經提交了該文件。所以,根據我見過的教程,它不應該試圖預編譯這些文件。爲什麼忽略我的manifest.yml文件?
請讓我知道我能做些什麼。我想不明白。
謝謝!
它實際上看起來像DATABASE_URL設置不正確,因爲錯誤是在數據庫連接。運行'heroku config'時DATABASE_URL顯示的內容。你有沒有建立一個數據庫加載項? –
感謝您的回覆。我運行了heroku配置,並且myapp沒有配置變量。我假設這是因爲我以前從未部署過任何服務器。 – user2951507
@PeterGoldstein除了在入門教程中採取的步驟之外,我還沒有對數據庫做更多的事情。我應該採取額外的步驟嗎? – user2951507