【问题标题】:Heroku Rails Internal Server ErrorHeroku Rails 内部服务器错误
【发布时间】:2010-05-10 00:49:40
【问题描述】:

当我尝试在 heroku 上部署我的 rails 应用程序时,出现 500 Internal Sever 错误。它在我的本地机器上运行良好,所以我不确定这里有什么问题。似乎与家庭控制器上的“会话”有关。这是我的日志:

==> 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 的 RESTful 身份验证)

【问题讨论】:

    标签: ruby-on-rails ruby deployment heroku


    【解决方案1】:

    您的应用似乎正在寻找会话表。

    您是否已运行所有迁移?

    有时使用 heroku db:push 可以帮助确保您的数据库在本地和远程是相同的。

    【讨论】:

      【解决方案2】:

      听起来你忘了heroku rake db:migrate

      【讨论】:

        【解决方案3】:

        另外,heroku rake db:sessions:create。创建会话表。

        也迁移。 heroku rake db:migrate 干杯! :)

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2015-11-23
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-01-12
          相关资源
          最近更新 更多