當我運行'英雄本地'時,一切正常工作!如何解決這個問題以將Rails應用程序部署到Heroku?
但是,當我運行「的Heroku開放」,這是行不通的:
「你要找的頁面不存在,你可能打錯 地址或頁面可能已經移動。 。如果您是應用程序 所有者,請檢查日誌以獲取更多信息。「
這是我的Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
ruby '2.2.1'
gem 'rails', '4.0.2'
gem 'puma'
gem 'foreman'
# Use postgresql as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '5.0.2'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
這是Procfile:
web: bundle exec puma -e -p 5000 -S ~/puma -C config/puma.rb
這是文件日誌:
2015-05-20T12:38:42.297654+00:00 app[web.1]: Started GET "/" for 183.81.86.77 at 2015-05-20 12:38:42 +0000
2015-05-20T12:38:42.392427+00:00 app[web.1]:
2015-05-20T12:38:42.392433+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/"):
2015-05-20T12:38:42.392437+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.2/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2015-05-20T12:38:42.392445+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.2/lib/active_support/tagged_logging.rb:67:in `tagged'
2015-05-20T12:38:42.392435+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.2/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2015-05-20T12:38:42.392452+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.2/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2015-05-20T12:38:42.392456+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.2/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2015-05-20T12:38:42.392439+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.0.2/lib/rails/rack/logger.rb:38:in `call_app'
2015-05-20T12:38:42.392440+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.0.2/lib/rails/rack/logger.rb:20:in `block in call'
2015-05-20T12:38:42.392458+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/actionpack-4.0.2/lib/action_dispatch/middleware/static.rb:64:in `call'
2015-05-20T12:38:42.392459+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
2015-05-20T12:38:42.392461+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.0.2/lib/rails/engine.rb:511:in `call'
2015-05-20T12:38:42.392462+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.0.2/lib/rails/application.rb:97:in `call'
2015-05-20T12:38:42.392463+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/puma-2.11.1/lib/puma/configuration.rb:82:in `call'
2015-05-20T12:38:42.392442+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.2/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2015-05-20T12:38:42.392443+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/activesupport-4.0.2/lib/active_support/tagged_logging.rb:25:in `tagged'
2015-05-20T12:38:42.392466+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/puma-2.11.1/lib/puma/server.rb:375:in `process_client'
2015-05-20T12:38:42.392467+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/puma-2.11.1/lib/puma/server.rb:262:in `block in run'
2015-05-20T12:38:42.392455+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2015-05-20T12:38:42.392453+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2015-05-20T12:38:42.392450+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/railties-4.0.2/lib/rails/rack/logger.rb:20:in `call'
2015-05-20T12:38:42.392468+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/puma-2.11.1/lib/puma/thread_pool.rb:104:in `call'
2015-05-20T12:38:42.392470+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/puma-2.11.1/lib/puma/thread_pool.rb:104:in `block in spawn_thread'
2015-05-20T12:38:42.392472+00:00 app[web.1]:
2015-05-20T12:38:42.392464+00:00 app[web.1]: vendor/bundle/ruby/2.2.0/gems/puma-2.11.1/lib/puma/server.rb:507:in `handle_request'
2015-05-20T12:38:42.392471+00:00 app[web.1]:
2015-05-20T12:38:42.777619+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=bachvanngoc.herokuapp.com request_id=29570c12-9b74-4b70-b109-7365acb4938e fwd="183.81.86.77" dyno=web.1 connect=0ms service=2ms status=200 bytes=143
2015-05-20T12:38:41.882707+00:00 heroku[web.1]: State changed from starting to up
WARNING: Toolbelt v3.37.1 update available.
運行'heroku logs'檢查日誌;會給出一個錯誤的概念。 –
謝謝,我更新了 – NeverSmile
根據控制檯/日誌輸出,你沒有在你的'config/routes.rb'文件中定義一個基本路由(即''root':'some_controller#some_action'')。 –