所以我想在我的网络应用程序中使用Devise,并且在localhost上测试的一切都很好,但当我将它上传到我的ec2实例时,我收到错误'没有路由匹配[GET]“/”'和我不知道怎么解决这个问题。
这是我的Routes.rb:
devise_for :users
resources :submissions
root to: 'home#index'
scope "api" do
get "/submissions(.:format)" => "submissions#index"
get "/submissions/:id(.:format)" => "submissions#show"
end
get "/submissions/:id/edit(.:format)" => "submissions#edit"
这是我的Gemfile,记住我确实尝试过只有gem:“设计”,但这也不起作用。
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'therubyracer'
# 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'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem "devise", :git => "git://github.com/plataformatec/devise.git"
这是我的ec2实例上的routes.rb:
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
submissions GET /submissions(.:format) submissions#index
POST /submissions(.:format) submissions#create
new_submission GET /submissions/new(.:format) submissions#new
edit_submission GET /submissions/:id/edit(.:format) submissions#edit
submission GET /submissions/:id(.:format) submissions#show
PUT /submissions/:id(.:format) submissions#update
DELETE /submissions/:id(.:format) submissions#destroy
root / home#index
GET /api/submissions(.:format) submissions#index
GET /api/submissions/:id(.:format) submissions#show
GET /submissions/:id/edit(.:format) submissions#edit
答案 0 :(得分:1)
您可以使用rake routes
检查是否有此路线。
您是否已在生产模式下本地运行?
如果仍然无法解决此问题,您最好粘贴rake routes
的结果,然后有人可能会弄明白。
答案 1 :(得分:0)
在您的应用程序的根目录运行它,并检查它是否返回根路由。
rake routes | grep root