2013-03-03 56 views
1

當我在控制檯輸入:Rails的生產+ Heroku的

git push heroku master 

我得到:

 Your bundle is complete! It was installed into ./vendor/bundle 
     Cleaning up the bundler cache. 
     Would have removed sass-rails (3.2.6) 
     Would have removed sass (3.2.5) 
-----> Writing config/database.yml to read from DATABASE_URL 
-----> Preparing app for Rails asset pipeline 
     Running: rake assets:precompile 
     Asset precompilation completed (13.99s) 
-----> Rails plugin injection 
     Injecting rails_log_stdout 
     Injecting rails3_serve_static_assets 
-----> Discovering process types 
     Procfile declares types  -> (none) 
     Default types for Ruby/Rails -> console, rake, web, worker 

-----> Compiled slug size: 12.0MB 
-----> Launching... done, v7 
     http://chernobylmusic.herokuapp.com deployed to Heroku 

運行:

heroku run rake db:migrate 

結果是:

Running `rake db:migrate` attached to terminal... up, run.5186 
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 <top (required)> at /app/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 <top (required)> at /app/Rakefile:7) 

並且應用遷移。

當我訪問我的網頁在Heroku上,我看到We're sorry, but something went wrong.

+0

跟蹤heroku日誌並粘貼它..只有我們可以幫助你 – AnkitG 2013-03-03 12:02:39

+0

http://old.pastie.org/6370337 – technobot 2013-03-03 12:13:53

回答

6

運行heroku logs,並期待在錯誤

0

錯誤日誌說

PG::Error: ERROR: relation "events" does not exist 

這意味着你沒有DB創建,甚至你沒有你的遷移運行。檢查你的Gemfile中是否有pg gem。如果不在你的Gemfile的生產塊中添加gem 'pg',因爲Heroku在postgres上運行。

THN做

git push heroku master 

THN

heroku run rake db:create 

THN

heroku run rake db:migrate 

它應該工作。

+0

如果'pg'不在Gemfile中,在部署過程中不會出現heroku錯誤嗎? – enthrops 2013-03-03 12:46:14

+0

全部完成。但http://old.pastie.org/6371695 – technobot 2013-03-03 17:02:17

+0

@technobot檢查日誌現在它說'@ events.reverse.last.img'上的未定義方法'img'...檢查img是一個有效的屬性。 – AnkitG 2013-03-03 22:08:40