RoR 4没有正确推送到heroku

时间:2014-03-01 02:20:32

标签: ruby-on-rails heroku

编码有点新,只是把我的网站推到了heroku。我以前做过没有任何问题,但现在它给了我“我们很抱歉,但出了点问题。”每当我尝试去现场时。 我运行了heroku logs --tail,这就是它给我的东西。

  ←[36m2014-03-01T02:16:42.201339+00:00 app[web.1]:←[0m ):
  ←[36m2014-03-01T02:16:42.201152+00:00 app[web.1]:←[0m
  ←[36m2014-03-01T02:16:42.201152+00:00 app[web.1]:←[0m
  ←[36m2014-03-01T02:16:42.200792+00:00 app[web.1]:←[0m  vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/cache/strategy/local_cache.rb:83:in `call' 

稍后我会看到这个

←[36m2014-03-01T02:16:42.201734+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.2/lib/abstract_controller/rendering.rb:120:in `render_to_body'
←[36m2014-03-01T02:16:42.201152+00:00 app[web.1]:←[0m ActionView::MissingTemplate (Missing template pages/opening, application/opening with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :build
er, :raw, :ruby, :jbuilder, :coffee]}. Searched in:
  ←[36m2014-03-01T02:16:42.201921+00:00 app[web.1]:←[0m   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/callbacks.rb:413:in `_run__2841248799560977586__process_action__callbacks'

我从未见过这个错误,我很困惑。让我知道我应该在这里发布什么。这是我的git中心页面https://github.com/Thefoodie/PupPics

1 个答案:

答案 0 :(得分:0)

错误

ActionView::MissingTemplate (Missing template pages/opening, application/opening with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :build er, :raw, :ruby, :jbuilder, :coffee]}. Searched in:

这是标准view is missing错误 - 基本上意味着/views/pages/opening.html.erb文件尚未上传:

  1. 确保您有/views/pages/opening.html.erb
  2. 的文件
  3. 确保您已添加&将文件提交给git:

    • git add .
    • git commit -a -m "Opening"
    • git push heroku master

  4. Exception Notification

    你可以使用名为exception notification的优秀宝石:

      

    Exception Notification gem提供了一组发送通知程序   Rack / Rails应用程序中发生错误时的通知

    如果您这样安装,您将能够直接收到错误消息到您的电子邮件收件箱。以下是您设置的方式:

    #GemFile
    gem "exception_notification", "~> 4.0.1"
    
    #config/environments/production.rb
    Whatever::Application.config.middleware.use ExceptionNotification::Rack,
      :email => {
        :email_prefix => "[Whatever] ",
        :sender_address => %{"notifier" <notifier@your_domain.com>},
        :exception_recipients => %w{you@domain.com}
    }
    

    然后,您需要收到电子邮件,最好使用第三方SMTP平台,例如SendGridMandrill

    #config/environments/production.rb
    ActionMailer::Base.smtp_settings = {
      :address        => "smtp.sendgrid.net",
      :port           => "25",
      :authentication => :plain,
      :user_name      => ENV['SENDGRID_USERNAME'],
      :password       => ENV['SENDGRID_PASSWORD'],
      :domain         => ENV['SENDGRID_DOMAIN']
    }