1

我最近将它部署到我正在处理的 Rails 项目的 Heroku 服务器上。它在 localhost:3000 中运行良好 100%,当我把它放在服务器上时,整个东西都坏了,不会加载我在routes.rb文件中设置的页面。我设置正确,我希望它在我上传之前一直有效。任何帮助将不胜感激,如果您需要查看任何代码,请询问。

请记住,gem 'pg'当我安装和上传没有问题时,我做得正确。

再次感谢各位!

以下是日志:


2013-05-25T00:23:25.987816+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2013-05-25T00:23:25.987816+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2013-05-25T00:23:25.988073+00:00 app[web.1]: 
2013-05-25T00:23:25.988073+00:00 app[web.1]: 
2013-05-25T00:23:25.987816+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2013-05-25T00:23:25.988073+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
2013-05-25T00:23:25.988073+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
2013-05-25T00:23:25.988073+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
2013-05-25T00:23:25.988073+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/rack/log_tailer.rb:17:in `call'
2013-05-25T00:24:33.883833+00:00 heroku[slugc]: Slug compilation started
2013-05-25T00:25:31.896062+00:00 heroku[api]: Deploy d1d2873 by mikehuebner@me.com
2013-05-25T00:25:31.914159+00:00 heroku[api]: Release v13 created by mikehuebner@me.com
2013-05-25T00:25:31.954791+00:00 heroku[api]: Deploy d1d2873 by mikehuebner@me.com
2013-05-25T00:25:32.444200+00:00 heroku[slugc]: Slug compilation finished
2013-05-25T00:25:32.589317+00:00 heroku[web.1]: State changed from up to starting
2013-05-25T00:25:35.061089+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2013-05-25T00:25:35.677607+00:00 app[web.1]: [2013-05-25 00:25:35] ERROR SignalException: SIGTERM
2013-05-25T00:25:35.677607+00:00 app[web.1]:    /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2013-05-25T00:25:36.686445+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 13357`
2013-05-25T00:25:40.594308+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T00:25:40.594308+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T00:25:40.594308+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-05-25T00:25:43.427364+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-05-25T00:25:43.427364+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-05-25T00:25:43.427364+00:00 app[web.1]: => Booting WEBrick
2013-05-25T00:25:43.427364+00:00 app[web.1]: => Call with -d to detach
2013-05-25T00:25:43.427364+00:00 app[web.1]: => Rails 3.2.11 application starting in production on http://0.0.0.0:13357
2013-05-25T00:25:43.887817+00:00 heroku[web.1]: State changed from starting to up
2013-05-25T00:25:43.652487+00:00 app[web.1]: [2013-05-25 00:25:43] INFO  WEBrick 1.3.1
2013-05-25T00:25:43.652487+00:00 app[web.1]: [2013-05-25 00:25:43] INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]
2013-05-25T00:25:43.652908+00:00 app[web.1]: [2013-05-25 00:25:43] INFO  WEBrick::HTTPServer#start: pid=2 port=13357
2013-05-25T00:25:46.116630+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2013-05-25T00:25:46.116630+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2013-05-25T00:25:48.112984+00:00 heroku[web.1]: Process exited with status 137
2013-05-25T00:35:18.223060+00:00 app[web.1]: Started GET "/" for 24.234.188.213 at 2013-05-25 00:35:18 +0000
2013-05-25T00:35:18.393606+00:00 app[web.1]: Processing by HomeController#index as HTML
2013-05-25T00:35:18.459940+00:00 app[web.1]: WARN: tilt autoloading 'less' in a non thread-safe way; explicit require 'less' suggested.
2013-05-25T00:35:18.455562+00:00 app[web.1]:   Rendered home/index.html.erb within layouts/application (13.5ms)
2013-05-25T00:35:18.772566+00:00 heroku[router]: at=info method=GET path=/ host=rubybootstrap.herokuapp.com fwd="24.234.188.213" dyno=web.1 connect=13ms service=566ms status=500 bytes=643
2013-05-25T00:35:18.772565+00:00 app[web.1]: 
2013-05-25T00:35:18.772565+00:00 app[web.1]: ActionView::Template::Error ('twitter/bootstrap/bootstrap.less' wasn't found.
2013-05-25T00:35:18.772565+00:00 app[web.1]:     13:     <![endif]-->
2013-05-25T00:35:18.772565+00:00 app[web.1]:     16: 
2013-05-25T00:35:18.772948+00:00 app[web.1]: 
2013-05-25T00:35:18.772948+00:00 app[web.1]: 
2013-05-25T00:35:18.770213+00:00 app[web.1]: Completed 500 Internal Server Error in 376ms
2013-05-25T00:35:18.772565+00:00 app[web.1]:     12:       <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
2013-05-25T00:35:18.772565+00:00 app[web.1]:     14: 
2013-05-25T00:35:18.772565+00:00 app[web.1]:     15:     <%= stylesheet_link_tag "application", :media => "all" %>
2013-05-25T00:35:18.772565+00:00 app[web.1]:     17:   <body>
2013-05-25T00:35:18.772565+00:00 app[web.1]:   (in /app/app/assets/stylesheets/bootstrap_and_overrides.css.less)):
2013-05-25T00:35:18.772948+00:00 app[web.1]:     18:   <div class="navbar navbar-inverse navbar-fixed-top">
2013-05-25T00:35:18.772565+00:00 app[web.1]: 
2013-05-25T00:35:18.772948+00:00 app[web.1]:   app/views/layouts/application.html.erb:15:in `_app_views_layouts_application_html_erb__3170578853202945949_30458520'
2013-05-25T00:35:19.186316+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=rubybootstrap.herokuapp.com fwd="24.234.188.213" dyno=web.1 connect=2ms service=12ms status=200 bytes=0
2013-05-25T00:43:18.858790+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by mikehuebner@me.com
2013-05-25T00:43:21.280321+00:00 heroku[run.1023]: Awaiting client
2013-05-25T00:43:21.299064+00:00 heroku[run.1023]: Starting process with command `bundle exec rake db:migrate`
2013-05-25T00:43:22.091117+00:00 heroku[run.1023]: State changed from starting to up
2013-05-25T00:43:27.798880+00:00 heroku[run.1023]: Process exited with status 0
2013-05-25T00:43:27.818146+00:00 heroku[run.1023]: State changed from up to complete
2013-05-25T00:43:28.362648+00:00 app[web.1]: Started GET "/" for 24.234.188.213 at 2013-05-25 00:43:28 +0000
2013-05-25T00:43:28.367176+00:00 app[web.1]:   Rendered home/index.html.erb within layouts/application (1.1ms)
2013-05-25T00:43:28.365493+00:00 app[web.1]: Processing by HomeController#index as HTML
2013-05-25T00:43:28.383978+00:00 app[web.1]: Completed 500 Internal Server Error in 18ms
2013-05-25T00:43:28.385884+00:00 app[web.1]:     15:     <%= stylesheet_link_tag "application", :media => "all" %>
2013-05-25T00:43:28.385884+00:00 app[web.1]:   (in /app/app/assets/stylesheets/bootstrap_and_overrides.css.less)):
2013-05-25T00:43:28.385884+00:00 app[web.1]: 
2013-05-25T00:43:28.385884+00:00 app[web.1]:     13:     <![endif]-->
2013-05-25T00:43:28.385884+00:00 app[web.1]:     17:   <body>
2013-05-25T00:43:28.385884+00:00 app[web.1]: ActionView::Template::Error ('twitter/bootstrap/bootstrap.less' wasn't found.
2013-05-25T00:43:28.385884+00:00 app[web.1]:     14: 
2013-05-25T00:43:28.386150+00:00 app[web.1]:   app/views/layouts/application.html.erb:15:in `_app_views_layouts_application_html_erb__3170578853202945949_30458520'
2013-05-25T00:43:28.385884+00:00 app[web.1]:     12:       <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
2013-05-25T00:43:28.386150+00:00 app[web.1]: 
2013-05-25T00:43:28.385884+00:00 app[web.1]: 
2013-05-25T00:43:28.386150+00:00 app[web.1]:     18:   <div class="navbar navbar-inverse navbar-fixed-top">
2013-05-25T00:43:28.386150+00:00 app[web.1]: 
2013-05-25T00:43:28.385884+00:00 app[web.1]:     16: 
2013-05-25T00:43:28.405477+00:00 heroku[router]: at=info method=GET path=/ host=rubybootstrap.herokuapp.com fwd="24.234.188.213" dyno=web.1 connect=8ms service=49ms status=500 bytes=643
2013-05-25T00:43:28.708313+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=rubybootstrap.herokuapp.com fwd="24.234.188.213" dyno=web.1 connect=3ms service=10ms status=304 bytes=0
2013-05-25T00:50:11.894584+00:00 app[web.1]: Started GET "/" for 77.253.195.44 at 2013-05-25 00:50:11 +0000
2013-05-25T00:50:11.897159+00:00 app[web.1]: Processing by HomeController#index as HTML
2013-05-25T00:50:11.899760+00:00 app[web.1]:   Rendered home/index.html.erb within layouts/application (1.1ms)
2013-05-25T00:50:11.919045+00:00 app[web.1]:     12:       <script src="http://html5shim.googlecode.com/svn/trunk/html5.js" type="text/javascript"></script>
2013-05-25T00:50:11.919045+00:00 app[web.1]: 
2013-05-25T00:50:11.919045+00:00 app[web.1]:     14: 
2013-05-25T00:50:11.916376+00:00 app[web.1]: Completed 500 Internal Server Error in 18ms
2013-05-25T00:50:11.919045+00:00 app[web.1]: ActionView::Template::Error ('twitter/bootstrap/bootstrap.less' wasn't found.
2013-05-25T00:50:11.919045+00:00 app[web.1]:     16: 
2013-05-25T00:50:11.919045+00:00 app[web.1]:     17:   <body>
2013-05-25T00:50:11.919045+00:00 app[web.1]:     13:     <![endif]-->
2013-05-25T00:50:11.919045+00:00 app[web.1]:     15:     <%= stylesheet_link_tag "application", :media => "all" %>
2013-05-25T00:50:11.919352+00:00 app[web.1]:   app/views/layouts/application.html.erb:15:in `_app_views_layouts_application_html_erb__3170578853202945949_30458520'
2013-05-25T00:50:11.919352+00:00 app[web.1]:     18:   <div class="navbar navbar-inverse navbar-fixed-top">
2013-05-25T00:50:11.919352+00:00 app[web.1]: 
2013-05-25T00:50:11.919045+00:00 app[web.1]: 
2013-05-25T00:50:11.919045+00:00 app[web.1]:   (in /app/app/assets/stylesheets/bootstrap_and_overrides.css.less)):
2013-05-25T00:50:11.919352+00:00 app[web.1]: 
2013-05-25T00:50:11.933941+00:00 heroku[router]: at=info method=GET path=/ host=rubybootstrap.herokuapp.com fwd="77.253.195.44" dyno=web.1 connect=9ms service=46ms status=500 bytes=643
2013-05-25T00:50:12.298289+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=rubybootstrap.herokuapp.com fwd="77.253.195.44" dyno=web.1 connect=5ms service=38ms status=200 bytes=0

宝石文件:

source 'http://rubygems.org'

gem 'rails', '3.2.11'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :production do
 gem 'pg', '0.12.2'
end

group :development, :test do
  gem "sqlite3", :require => "sqlite3"
end
#Change to 'pg' and run bundle install

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
4

1 回答 1

0

根据Rails Guides,资产组下的宝石不包括在生产组中。这是指南所说的部分:

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   "~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

如果您将资产组与 Bundler 一起使用,请确保您的 config/application.rb 具有以下 Bundler 要求语句:

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require *Rails.groups(:assets => %w(development test))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

对于您的情况,您需要添加production到需要资产组的环境列表中:

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require *Rails.groups(:assets => %w(development test production))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

或者,您也可以使用注释掉的代码:

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  # Bundler.require *Rails.groups(:assets => %w(development test production))
  # If you want your assets lazily compiled in production, use this line
  Bundler.require(:default, :assets, Rails.env)
end
于 2013-05-25T02:00:42.050 回答