【发布时间】:2014-01-09 13:48:51
【问题描述】:
我使用的是 Ruby 1.9 版和 Rails 3.2 版
我已将其包含在我的 gemfile 中(按照 Micheal Hartl 在他的书中的指示)
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
我的 repo 在我的本地服务器上运行良好,我也可以在 Heroku 上成功部署它(例如,它没有显示任何错误)但是当我尝试在 Heroku 上打开它时,它说发生了一些错误.
Heroku 链接:
Link to heroku application which isn't working
我的 Github 仓库:
如何让我的 rails 应用程序在 Heroku 上运行?
编辑:
这是 Heroku 日志:
2014-01-09T14:29:19.456148+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
2014-01-09T14:29:19.456148+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2014-01-09T14:29:19.456383+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
2014-01-09T14:29:19.456383+00:00 app[web.1]: script/rails:6:in `require'
2014-01-09T14:29:19.456383+00:00 app[web.1]: script/rails:6:in `<main>'
2014-01-09T14:29:19.456383+00:00 app[web.1]: [2014-01-09 14:29:19] INFO going to shutdown ...
2014-01-09T14:29:19.456148+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
2014-01-09T14:29:19.456148+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
2014-01-09T14:29:19.456383+00:00 app[web.1]: [2014-01-09 14:29:19] INFO WEBrick::HTTPServer#start done.
2014-01-09T14:29:19.456383+00:00 app[web.1]: Exiting
2014-01-09T14:29:20.728995+00:00 heroku[web.1]: Process exited with status 143
2014-01-09T14:29:21.335721+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 30327`
2014-01-09T14:29:26.583076+00:00 app[web.1]: [2014-01-09 14:29:26] INFO WEBrick::HTTPServer#start: pid=2 port=30327
2014-01-09T14:29:26.582958+00:00 app[web.1]: [2014-01-09 14:29:26] INFO ruby 2.0.0 (2013-11-22) [x86_64-linux]
2014-01-09T14:29:26.582958+00:00 app[web.1]: [2014-01-09 14:29:26] INFO WEBrick 1.3.1
2014-01-09T14:29:26.780187+00:00 heroku[web.1]: State changed from starting to up
2014-01-09T14:29:31.141689+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:30327
2014-01-09T14:29:31.141689+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-01-09T14:29:31.141689+00:00 app[web.1]: Started GET "/" for 115.253.102.219 at 2014-01-09 14:29:31 +0000
2014-01-09T14:29:31.141689+00:00 app[web.1]: => Booting WEBrick
2014-01-09T14:29:31.141689+00:00 app[web.1]: => Call with -d to detach
2014-01-09T14:29:31.417971+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2014-01-09T14:29:31.565602+00:00 app[web.1]: Processing by PagesController#home as HTML
2014-01-09T14:29:31.573778+00:00 app[web.1]: Rendered pages/home.html.erb within layouts/application (2.0ms)
2014-01-09T14:29:31.577581+00:00 heroku[router]: at=info method=GET path=/ host=khems.herokuapp.com fwd="115.253.102.219" dyno=web.1 connect=2ms service=461ms status=500 bytes=643
2014-01-09T14:29:31.582759+00:00 app[web.1]: 3: <![endif]-->
2014-01-09T14:29:31.582759+00:00 app[web.1]: 4: <%= stylesheet_link_tag 'blueprint/screen' , :media => 'screen' %>
2014-01-09T14:29:31.579472+00:00 app[web.1]: Rendered layouts/_stylesheets.html.erb (2.5ms)
2014-01-09T14:29:31.582759+00:00 app[web.1]: 1: <!--[if lt IE 9]>
2014-01-09T14:29:31.582759+00:00 app[web.1]: 6: <!--[if lt IE 8]>
2014-01-09T14:29:31.582759+00:00 app[web.1]: 7: <%= stylesheet_link_tag 'blueprint/ie' %>
2014-01-09T14:29:31.582759+00:00 app[web.1]: app/views/layouts/_stylesheets.html.erb:4:in `_app_views_layouts__stylesheets_html_erb__3247735197042063147_70327889246660'
2014-01-09T14:29:31.582985+00:00 app[web.1]: app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__3301566358678381586_70327889035920'
2014-01-09T14:29:31.582985+00:00 app[web.1]:
2014-01-09T14:29:31.582985+00:00 app[web.1]:
2014-01-09T14:29:31.582759+00:00 app[web.1]:
2014-01-09T14:29:31.582759+00:00 app[web.1]: 2: <script src = "http://html5shiv.googlecode.com/svn/truck/html5.js"></script>
2014-01-09T14:29:31.579878+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms
2014-01-09T14:29:31.582759+00:00 app[web.1]: ActionView::Template::Error (blueprint/screen.css isn't precompiled):
2014-01-09T14:29:31.582759+00:00 app[web.1]: 5: <%= stylesheet_link_tag 'blueprint/print' , :media=> 'print' %>
2014-01-09T14:29:34.837363+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=khems.herokuapp.com fwd="115.253.102.219" dyno=web.1 connect=1ms service=32ms status=200 bytes=0
2014-01-09T14:29:16.041585+00:00 heroku[api]: Deploy 34c58d2 by piyushkhemka123@gmail.com
2014-01-09T14:29:16.188472+00:00 heroku[api]: Release v13 created by piyushkhemka123@gmail.com
2014-01-09T14:31:30.246363+00:00 app[web.1]: Started GET "/" for 115.253.102.219 at 2014-01-09 14:31:30 +0000
2014-01-09T14:31:30.252668+00:00 app[web.1]: Processing by PagesController#home as HTML
2014-01-09T14:31:30.254018+00:00 app[web.1]: Rendered pages/home.html.erb within layouts/application (0.4ms)
2014-01-09T14:31:30.261045+00:00 app[web.1]: ActionView::Template::Error (blueprint/screen.css isn't precompiled):
2014-01-09T14:31:30.261045+00:00 app[web.1]: 2: <script src = "http://html5shiv.googlecode.com/svn/truck/html5.js"></script>
2014-01-09T14:31:30.261045+00:00 app[web.1]: 3: <![endif]-->
2014-01-09T14:31:30.261045+00:00 app[web.1]: 7: <%= stylesheet_link_tag 'blueprint/ie' %>
2014-01-09T14:31:30.261045+00:00 app[web.1]: app/views/layouts/_stylesheets.html.erb:4:in `_app_views_layouts__stylesheets_html_erb__3247735197042063147_70327889246660'
2014-01-09T14:31:30.261220+00:00 app[web.1]: app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__3301566358678381586_70327889035920'
2014-01-09T14:31:30.262525+00:00 heroku[router]: at=info method=GET path=/ host=khems.herokuapp.com fwd="115.253.102.219" dyno=web.1 connect=5ms service=30ms status=500 bytes=643
2014-01-09T14:31:30.258672+00:00 app[web.1]: Rendered layouts/_stylesheets.html.erb (0.9ms)
2014-01-09T14:31:30.261045+00:00 app[web.1]:
2014-01-09T14:31:30.258971+00:00 app[web.1]: Completed 500 Internal Server Error in 6ms
2014-01-09T14:31:30.261045+00:00 app[web.1]: 1: <!--[if lt IE 9]>
2014-01-09T14:31:30.261045+00:00 app[web.1]: 4: <%= stylesheet_link_tag 'blueprint/screen' , :media => 'screen' %>
2014-01-09T14:31:30.261045+00:00 app[web.1]: 5: <%= stylesheet_link_tag 'blueprint/print' , :media=> 'print' %>
2014-01-09T14:31:30.261220+00:00 app[web.1]:
2014-01-09T14:31:30.261220+00:00 app[web.1]:
2014-01-09T14:31:30.261045+00:00 app[web.1]: 6: <!--[if lt IE 8]>
2014-01-09T14:38:53.893957+00:00 heroku[router]: at=info method=GET path=/robots.txt host=khems.herokuapp.com fwd="50.17.151.94" dyno=web.1 connect=2ms service=32ms status=200 bytes=204
2014-01-09T14:38:53.935144+00:00 app[web.1]: Started GET "/" for 50.17.151.94 at 2014-01-09 14:38:53 +0000
2014-01-09T14:38:53.947809+00:00 app[web.1]: Processing by PagesController#home as */*
2014-01-09T14:38:53.952314+00:00 app[web.1]: Rendered pages/home.html.erb within layouts/application (1.0ms)
2014-01-09T14:38:53.954570+00:00 app[web.1]: Completed 500 Internal Server Error in 7ms
2014-01-09T14:38:53.954280+00:00 app[web.1]: Rendered layouts/_stylesheets.html.erb (1.6ms)
2014-01-09T14:38:53.956529+00:00 app[web.1]: ActionView::Template::Error (blueprint/screen.css isn't precompiled):
2014-01-09T14:38:53.956529+00:00 app[web.1]: 2: <script src = "http://html5shiv.googlecode.com/svn/truck/html5.js"></script>
2014-01-09T14:38:53.956529+00:00 app[web.1]: 3: <![endif]-->
2014-01-09T14:38:53.956529+00:00 app[web.1]: 1: <!--[if lt IE 9]>
2014-01-09T14:38:53.956529+00:00 app[web.1]: 4: <%= stylesheet_link_tag 'blueprint/screen' , :media => 'screen' %>
2014-01-09T14:38:53.956529+00:00 app[web.1]: 5: <%= stylesheet_link_tag 'blueprint/print' , :media=> 'print' %>
2014-01-09T14:38:53.956529+00:00 app[web.1]:
2014-01-09T14:38:53.956529+00:00 app[web.1]: 6: <!--[if lt IE 8]>
2014-01-09T14:38:53.956529+00:00 app[web.1]: 7: <%= stylesheet_link_tag 'blueprint/ie' %>
2014-01-09T14:38:53.956529+00:00 app[web.1]: app/views/layouts/_stylesheets.html.erb:4:in `_app_views_layouts__stylesheets_html_erb__3247735197042063147_70327889246660'
2014-01-09T14:38:53.956710+00:00 app[web.1]: app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__3301566358678381586_70327889035920'
2014-01-09T14:38:53.956710+00:00 app[web.1]:
2014-01-09T14:38:53.956710+00:00 app[web.1]:
2014-01-09T14:38:53.963277+00:00 heroku[router]: at=info method=GET path=/ host=khems.herokuapp.com fwd="50.17.151.94" dyno=web.1 connect=7ms service=36ms status=500 bytes=643
2014-01-09T14:39:54.023115+00:00 app[web.1]: Started GET "/" for 115.253.102.219 at 2014-01-09 14:39:54 +0000
2014-01-09T14:39:54.029462+00:00 app[web.1]: Processing by PagesController#home as HTML
2014-01-09T14:39:54.030376+00:00 app[web.1]: Rendered pages/home.html.erb within layouts/application (0.3ms)
2014-01-09T14:39:54.031387+00:00 app[web.1]: Rendered layouts/_stylesheets.html.erb (0.6ms)
2014-01-09T14:39:54.031484+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2014-01-09T14:39:54.033858+00:00 app[web.1]:
2014-01-09T14:39:54.033858+00:00 app[web.1]: ActionView::Template::Error (blueprint/screen.css isn't precompiled):
2014-01-09T14:39:54.033858+00:00 app[web.1]: 1: <!--[if lt IE 9]>
2014-01-09T14:39:54.033858+00:00 app[web.1]: 2: <script src = "http://html5shiv.googlecode.com/svn/truck/html5.js"></script>
2014-01-09T14:39:54.033858+00:00 app[web.1]: 3: <![endif]-->
2014-01-09T14:39:54.033858+00:00 app[web.1]: 4: <%= stylesheet_link_tag 'blueprint/screen' , :media => 'screen' %>
2014-01-09T14:39:54.033858+00:00 app[web.1]: 5: <%= stylesheet_link_tag 'blueprint/print' , :media=> 'print' %>
2014-01-09T14:39:54.034039+00:00 app[web.1]: app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__3301566358678381586_70327889035920'
2014-01-09T14:39:54.033858+00:00 app[web.1]: 6: <!--[if lt IE 8]>
2014-01-09T14:39:54.033858+00:00 app[web.1]: 7: <%= stylesheet_link_tag 'blueprint/ie' %>
2014-01-09T14:39:54.033858+00:00 app[web.1]: app/views/layouts/_stylesheets.html.erb:4:in `_app_views_layouts__stylesheets_html_erb__3247735197042063147_70327889246660'
2014-01-09T14:39:54.034039+00:00 app[web.1]:
2014-01-09T14:39:54.034039+00:00 app[web.1]:
2014-01-09T14:39:54.033750+00:00 heroku[router]: at=info method=GET path=/ host=khems.herokuapp.com fwd="115.253.102.219" dyno=web.1 connect=1ms service=21ms status=500 bytes=643
这里是资产编译日志
E:/RailsInstaller/Ruby1.9.3/bin/ruby.exe E:/RailsInstaller/Ruby1.9.3/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
Compiled jquery.js (16ms) (pid 13464)
Compiled jquery_ujs.js (1ms) (pid 13464)
Compiled pages.js (198ms) (pid 13464)
Compiled users.js (205ms) (pid 13464)
Compiled application.js (494ms) (pid 13464)
Compiled custom.css (0ms) (pid 13464)
Compiled pages.css (12ms) (pid 13464)
Compiled users.css (4ms) (pid 13464)
Compiled application.css (62ms) (pid 13464)
Compiled jquery.js (21ms) (pid 11524)
Compiled jquery_ujs.js (0ms) (pid 11524)
Compiled pages.js (335ms) (pid 11524)
Compiled users.js (312ms) (pid 11524)
Compiled application.js (773ms) (pid 11524)
Compiled custom.css (0ms) (pid 11524)
Compiled pages.css (10ms) (pid 11524)
Compiled users.css (16ms) (pid 11524)
Compiled application.css (69ms) (pid 11524)
【问题讨论】:
-
你迁移数据库和预编译资产了吗?
-
我看到了你的Gemfile,请在本地控制台发出
bundle install --without=test,development -
所以你先
git add .,然后bundle install?执行以下操作。 1.bundle install --without=test,development并确保它没有错误通过,2. 问题bundle install,3. 问题git add .; 4. 发布git add -f Gemfile.lock5. 提交更改 6. 发布推送到heroku。 -
我没有看到
You have activated Rake 10.1.1 but your Gemfile requires 10.1.0错误...你能显示 heroku 推送日志吗? -
预编译错误提到了
screen.css,但我在编译日志的已编译资产列表中没有看到这一点。 CSS 文件可能没有包含在预编译中,如果您在开发中编译资产,您可能不会在本地注意到这一点。因此,它在生产环境中中断,但在其他地方没有。检查您的config/environments/文件夹,并比较开发与生产的各种config.assets选项。
标签: ruby-on-rails ruby-on-rails-3 heroku gemfile