0

我今天将应用程序上传到 Heroku 并看到此错误:应用程序错误

应用程序发生错误,无法提供您的页面。请稍后重试。

如果您是应用程序所有者,请查看您的日志以获取详细信息。

这个应用程序在本地工作。这是我的日志。有人有什么想法吗?

2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `block in require'

2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/engine.rb:436:in `each'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/initializable.rb:54:in `each'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
activesupport-3.2.6/lib/active_support/dependencies.rb:236:in `load_dependency'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/application.rb:136:in `initialize!'
2012-07-19T15:36:53+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/actives
upport-3.2.6/lib/active_support/dependencies.rb:251:in `require': /app/app/contr
ollers/comments_controller.rb:9: syntax error, unexpected $end, expecting keywor
d_end (SyntaxError)
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
activesupport-3.2.6/lib/active_support/dependencies.rb:359:in `require_or_load'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/railtie/configurable.rb:30:in `method_missing'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
activesupport-3.2.6/lib/active_support/dependencies.rb:313:in `depend_on'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-07-19T15:36:53+00:00 app[web.1]:   from config.ru:1:in `new'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
activesupport-3.2.6/lib/active_support/dependencies.rb:225:in `require_dependenc
y'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/engine.rb:438:in `block in eager_load!'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/initializable.rb:54:in `run_initializers'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
2012-07-19T15:36:53+00:00 app[web.1]:   from config.ru:3:in `block in <main>'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
thin-1.4.1/lib/rack/adapter/loader.rb:33:in `eval'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/engine.rb:438:in `each'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/application/finisher.rb:53:in `block in <module:Finishe
r>'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/initializable.rb:30:in `run'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/engine.rb:436:in `eager_load!'
2012-07-19T15:36:53+00:00 app[web.1]:   from config.ru:3:in `require'
2012-07-19T15:36:53+00:00 app[web.1]:   from config.ru:1:in `<main>'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
thin-1.4.1/lib/rack/adapter/loader.rb:33:in `load'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/t
hin:19:in `load'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
thin-1.4.1/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
thin-1.4.1/lib/thin/controllers/controller.rb:71:in `start'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
thin-1.4.1/bin/thin:6:in `<top (required)>'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/initializable.rb:30:in `instance_exec'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
railties-3.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/config/environment.rb:5:in `<t
op (required)>'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
thin-1.4.1/lib/thin/runner.rb:185:in `run_command'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/
thin-1.4.1/lib/thin/runner.rb:151:in `run!'
2012-07-19T15:36:53+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/t
hin:19:in `<main>'
2012-07-19T15:36:54+00:00 heroku[web.1]: Process exited with status 1
2012-07-19T15:36:54+00:00 heroku[web.1]: State changed from starting to crashed
2012-07-19T15:36:57+00:00 heroku[router]: Error H10 (App crashed) -> GET secret-
reaches-4317.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
2012-07-19T15:36:57+00:00 heroku[router]: Error H10 (App crashed) -> GET secret-
reaches-4317.herokuapp.com/favicon.ico dyno= queue= wait= service= status=503 bytes

我的控制器代码

class CommentsController < ApplicationController
 http_basic_authenticate_with :name => "test", :password => "test", :only => :destroy
  def create
    @post = Post.find(params[:post_id])
    @comment = @post.comments.create(params[:comment])
    redirect_to post_path(@post)
  end

  def destroy
    @post = Post.find(params[:post_id])
    @comment = @post.comments.find(params[:id])
    @comment.destroy
    redirect_to post_path(@post)
  end

end
4

1 回答 1

0

根据错误,您$end在应该使用时使用end. 但是,您向我们展示的代码是正确的。所以,我相信你在 heroku 上的代码和你在电脑上的代码不一样。

尝试将您的代码更新到 github,然后再次更新到 heroku:

git add .
git commit -m "update"
git push
git push heroko
于 2012-07-19T18:08:41.413 回答