0

我正在学习 rails 并第一次尝试部署测试应用程序。我一直在关注 capistrano 的指南。当我运行时,RAILS_ENV=production db:schema:load我得到了这个错误,我不确定什么是错的。

------- 不再适用(参考更新2)

path/to/rails/app$ rake RAILS_ENV=production db:schema:load --trace
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
missing :action
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/actionpack-4.0.0/lib/action_dispatch/routing/mapper.rb:233:in `default_controller_and_action'
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/actionpack-
......
......
......
......
......

/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:schema:load => environment

------------

这是我的 database.yml 文件

    # SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: mysql2
  database: test
  pool: 5
  username: username
  password: password
  socket: /var/run/mysqld/mysqld.sock
  timeout: 5000

谁能看到我做错了什么?谢谢。

更新:

我的 routes.rb 文件

Blog::Application.routes.draw do

  resources :users do
    resources :posts, except: [:index]
  end
  resources :posts, only: [:index]
  resources :sessions, only: [:create, :destroy]

  get "/signin" => "sessions#new"
  delete "/signout" => "sessions#destroy"
  root "static_pages#index"

  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  # root 'welcome#index'

  # Example of regular route:
  #   get 'products/:id' => 'catalog#view'

  # Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

  # Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Example resource route with more complex sub-resources:
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end

  # Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable

  # Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end

更新 2:

因此,根据以下建议,我将路线一一注释掉,但仍然出现错误。我查看了应用程序目录,我的应用程序文件与“当前”、“发布”和“共享”文件夹混合在一起,所以我很确定我的 deploy.rb 文件有问题。我修复了 deploy.rb 文件并从头开始重新启动部署过程。但现在我得到一个新的错误。

path/to/rails/app$ rake RAILS_ENV=production db:schema:load --trace
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:632:in `raw_load_rakefile'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.0.0-p247@global/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'

有什么建议么?谢谢

4

0 回答 0