2012-10-11 20 views
1

我跟着Heroku的官方指導推進軌道項目heroku工作。該application.rb文件是好的,我用正確的方式加入pg寶石和database.yml。當我推到heroku時,我得到:無法獲得的Heroku和Rails 3.x的PostgreSQL的

-----> Preparing app for Rails asset pipeline 
Detected manifest.yml, assuming assets were compiled locally 

但是,當我通過heroku open打開heroku時,出現錯誤。我把英雄日誌,並得到這個。

Started GET "/" for 93.45.227.255 at 2012-10-11 13:28:04 +0000 
2012-10-11T13:28:04+00:00 app[web.1]: Processing by ProductsController#index as HTML 
2012-10-11T13:28:04+00:00 app[web.1]: :    SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull 
2012-10-11T13:28:04+00:00 app[web.1]: ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "products" does not exist 
2012-10-11T13:28:04+00:00 app[web.1]: LINE 4:    WHERE a.attrelid = '"products"'::regclass 
2012-10-11T13:28:04+00:00 heroku[router]: GET gift4.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=203ms status=500 bytes=643 
2012-10-11T13:28:04+00:00 app[web.1]:): 
2012-10-11T13:28:04+00:00 app[web.1]:     ON a.attrelid = d.adrelid AND a.attnum = d.adnum 
2012-10-11T13:28:04+00:00 app[web.1]: 
2012-10-11T13:28:04+00:00 app[web.1]: 
2012-10-11T13:28:04+00:00 app[web.1]:          ^
2012-10-11T13:28:04+00:00 app[web.1]: 
2012-10-11T13:28:04+00:00 app[web.1]: Completed 500 Internal Server Error in 72ms 
2012-10-11T13:28:04+00:00 app[web.1]:    FROM pg_attribute a LEFT JOIN pg_attrdef d 
2012-10-11T13:28:04+00:00 app[web.1]:    WHERE a.attrelid = '"products"'::regclass 
2012-10-11T13:28:04+00:00 app[web.1]:    AND a.attnum > 0 AND NOT a.attisdropped 
2012-10-11T13:28:04+00:00 app[web.1]:    ORDER BY a.attnum 
2012-10-11T13:28:04+00:00 app[web.1]: app/controllers/products_controller.rb:5:in `index' 
2012-10-11T13:28:04+00:00 heroku[router]: GET gift4.herokuapp.com/favicon.ico d 

所以,我想

heroku run rake db:reset 

而得到這個

Heroku client internal error. 
! Search for help at: https://help.heroku.com 
! Or report a bug at: https://github.com/heroku/heroku/issues/new 

    Error:  Operation timed out - connect(2) (Errno::ETIMEDOUT) 
    Backtrace: /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/client/rendezvous.rb:39:in `initialize' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/client/rendezvous.rb:39:in `open' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/client/rendezvous.rb:39:in `block in start' 
       /Users/francescochecco/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:68:in `timeout' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/client/rendezvous.rb:31:in `start' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/command/run.rb:125:in `rendezvous_session' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/command/run.rb:112:in `run_attached' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/command/run.rb:21:in `index' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/command.rb:206:in `run' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/lib/heroku/cli.rb:28:in `start' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/gems/heroku-2.32.6/bin/heroku:16:in `<top (required)>' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/bin/heroku:19:in `load' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/bin/heroku:19:in `<main>' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval' 
       /Users/francescochecco/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>' 

    Command:  heroku run rake db:reset 
    Version:  heroku-gem/2.32.6 (x86_64-darwin11.3.0) ruby/1.9.3 autoupdate 

我什麼都試過。任何人可以幫忙?

+0

您是否運行遷移? –

+0

是的。我得到了同樣的錯誤 – framomo86

+0

嘗試更新heroku toolbelt與heroku更新 –

回答

2

你遷移數據庫?此錯誤:

(PG::Error: ERROR: relation "products" does not exist 

...通常表示您缺少表格。在這種情況下,您的products表可能不存在。

我同意db:reset應該載入您的架構適合你,所以這應該解決上述問題,在理論上。但是,超時很奇怪,也許是暫時的。

再次嘗試把你的應用程序,然後在命令行上,嘗試:

heroku run rake db:reset 

...或

heroku run rake db:migrate 

...讓我知道會發生什麼。

此外,什麼數據庫您的應用程序試圖使用(我猜的Postgres)?您database.ymlproduction部分通常由Heroku的忽略,因爲他們注入自己的production數據庫部分。

+0

我嘗試遷移並按照您的建議重置。我有同樣的錯誤。我試圖從頭開始創建一個新的應用程序。同樣的錯誤。我有紅寶石1.9.3 ...和最新的軌道寶石。 – framomo86

0

,應重置與

$ heroku pg:reset SHARED_DATABASE --confirm myapp 

Heroku的數據庫,然後做$ heroku restart

看看是否有幫助

然後嘗試遷移

+0

試過。它給出了同樣的錯誤 – framomo86

0

你本地編譯你推過嗎?如果是這樣,生成一個manifest.yml並可能導致heroku一側的錯誤。它已經很長時間了,但我曾經在本地進行預編譯(不知道爲什麼),而且我有這樣的錯誤......我想。不要在本地進行預編譯。如果您曾經在本地進行過預編譯進入您的公共目錄並刪除生成的資產文件夾。然後推送到heroku,看看它是否遠程編譯並清除您的問題。