找不到页面,使用Heroku

时间:2012-01-12 17:54:59

标签: ruby-on-rails-3 heroku http-status-code-404 production

我有一个Rails应用程序,我尝试在Heroku中部署,但它不起作用:

应用程序应加载默认页面“home”。在生产中运行本地服务器,使用rails server -e production工作正常:我的主页被加载并显示日志:

Started GET "/" for 127.0.0.1 at Thu Jan 12 18:43:06 +0100 2012
  Processing by PagesController#home as HTML
Rendered layouts/_stylesheets.html.erb (8.1ms)
Rendered layouts/_header_template.html.erb (49.6ms)
Rendered pages/home.html.erb within layouts/application (79.7ms)
Completed 200 OK in 101ms (Views: 98.2ms | ActiveRecord: 2.0ms)

我在Heroku上做了同样的想法(使用git create,然后是git heroku push master),我的应用程序似乎就在那里,但当我点击Heroku URL来访问我的应用程序时,我收到一条错误消息“你的页面正在寻找不存在“(404)。查看Heroku日志,我看到:

2012-01-12T17:33:36+00:00 app[web.1]: Started GET "/" for 109.129.111.38 at 2012-01-12 09:33:36 -0800
2012-01-12T17:33:36+00:00 app[web.1]: AbstractController::ActionNotFound (The action 'home' could not be found for PagesController)

我的route.rb文件是:

TapaG::Application.routes.draw do
  get "sessions/new"
  get "pages/home"

  resources :users
  resources :belongings
  resources :sessions, :only => [:new, :create, :destroy]

  get "pages/more_details"
  get "pages/infos_pratiques"
  get "pages/contact_us"

  #match 'Profil', :to => 'users#Profil'
  match "more_details", :to => "pages#more_details"
  match 'contact_us', :to => 'pages#contact_us'
  match "infos_pratiques", :to => "pages#infos_pratiques"
  match '/signup', :to => 'users#new'
  match '/signin', :to => 'sessions#new'
  match '/signout', :to => 'sessions#destroy'
  match '/belongings/new' => 'belongings#new'
  root :to => 'pages#home'

我的Gemfile如下;

source 'http://rubygems.org'

gem 'rails', '3.0.5'
gem 'will_paginate', '3.0.pre2'
gem 'jquery-rails', '>= 1.0.12'
gem "paperclip", "2.3.6"
gem "rake", "0.8.7"

group :development do
  gem 'rspec-rails', "2.0.1"
  gem 'annotate'
  gem 'faker', '0.3.1'
  gem 'populator', '1.0.0'
end

group :test do
  gem 'webrat'
  gem 'rspec', '2.0.1'
  gem 'factory_girl_rails', '1.0'
end

group :development, :test do
  gem 'sqlite3-ruby', :require=>'sqlite3'
end

我的页面控制器中有一个很好定义的“主页”操作,它在开发和生产中都可以正常工作。任何可能导致这种情况的想法? ..

提前感谢任何暗示!!

0 个答案:

没有答案
相关问题