2010-05-10 84 views
0

當我嘗試在heroku上部署我的Rails應用時,出現500內部服務器錯誤。它在我的本地機器上正常工作,所以我不確定這裏有什麼問題。似乎是家庭控制器上的「會話」。這是我的日誌:Heroku Rails內部服務器錯誤

==> production.log <== 
# Logfile created on Sun May 09 17:35:59 -0700 2010 

Processing HomeController#index (for 76.169.212.8 at 2010-05-09 17:36:00) [GET] 

ActiveRecord::StatementInvalid (PGError: ERROR: relation "sessions" does not ex 
ist 
:    SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a 
.attnotnull 
       FROM pg_attribute a LEFT JOIN pg_attrdef d 
       ON a.attrelid = d.adrelid AND a.attnum = d.adnum 
      WHERE a.attrelid = '"sessions"'::regclass 
       AND a.attnum > 0 AND NOT a.attisdropped 
      ORDER BY a.attnum 
): 
    lib/authenticated_system.rb:106:in `login_from_session' 
    lib/authenticated_system.rb:12:in `current_user' 
    lib/authenticated_system.rb:6:in `logged_in?' 
    lib/authenticated_system.rb:35:in `authorized?' 
    lib/authenticated_system.rb:53:in `login_required' 
    /home/heroku_rack/lib/static_assets.rb:9:in `call' 
    /home/heroku_rack/lib/last_access.rb:25:in `call' 
    /home/heroku_rack/lib/date_header.rb:14:in `call' 
    thin (1.2.7) lib/thin/connection.rb:76:in `pre_process' 
    thin (1.2.7) lib/thin/connection.rb:74:in `catch' 
    thin (1.2.7) lib/thin/connection.rb:74:in `pre_process' 
    thin (1.2.7) lib/thin/connection.rb:57:in `process' 
    thin (1.2.7) lib/thin/connection.rb:42:in `receive_data' 
    eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine' 
    eventmachine (0.12.10) lib/eventmachine.rb:256:in `run' 
    thin (1.2.7) lib/thin/backends/base.rb:57:in `start' 
    thin (1.2.7) lib/thin/server.rb:156:in `start' 
    thin (1.2.7) lib/thin/controllers/controller.rb:80:in `start' 
    thin (1.2.7) lib/thin/runner.rb:177:in `send' 
    thin (1.2.7) lib/thin/runner.rb:177:in `run_command' 
    thin (1.2.7) lib/thin/runner.rb:143:in `run!' 
    thin (1.2.7) bin/thin:6 
    /usr/local/bin/thin:20:in `load' 
    /usr/local/bin/thin:20 

Rendering /disk1/home/slugs/155328_f2d3c00_845e/mnt/public/500.html (500 Interna 
l Server Error) 

,這裏是我的home_controller.rb

class HomeController < ApplicationController 
    before_filter :login_required 

    def index 
     @user = current_user 
     @user.profile ||= Profile.new 
    @profile = @user.profile 
    end 

end 

是否有一些我的路由設置的方式嗎?還是我的身份驗證? (我正在使用Bort的寧靜認證)

回答

8

你的應用程序似乎在尋找一個會話表。

你運行了所有的遷移嗎?

有時它可以幫助使用heroku db:push確保您的數據庫在本地和遠程都是相同的。

2

聽起來像是你忘了heroku rake db:migrate

1

此外,heroku rake db:sessions:create。創建你的會話表。

也遷移。 heroku rake db:migrate乾杯! :)