Rails 大家把应用从 development 发布到 product,有没有遇到过问题吗?

bryanwong · 2012年02月14日 · 最后由 huacnlee 回复于 2012年02月14日 · 3066 次阅读

我遇到的问题:

  1. 在开发机上 ruby RAILS_ENV=production bundle exec rails s logs: cache: [GET /] miss
  2. 在 Heroku 上: ruby heroku logs ActionController::RoutingError (No route matches [GET] "/auth/twitter"): cache: [GET /auth/twitter] miss routes.rb ruby # auth match '/auth/:provider/callback' => 'sessions#create' match '/auth/failure' => 'sessions#failure' match '/signout' => 'sessions#destroy', :as => :signout match '/signin' => 'sessions#new', :as => :signin

找了一大堆 stackoverflow 的问答,都没有解决。大家有什么办法吗?

把 Omniauth 的配置发出来看看

看下 production log

@huacnlee omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :twitter, 'M7vwGTHl7vA7DfjND7E69w', 'vnwWIqdB2KRD1TpMZJpMk4mrlbOmPKw0YBzvu1CJio'
#   provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
end

@LeveyZhu 开发机上的 production log

Started GET "/" for 127.0.0.1 at 2012-02-14 10:58:51 +0800
Processing by HomeController#index as HTML
MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production.
Completed 500 Internal Server Error in 11ms

TypeError (db_name must be a string or symbol):
  app/controllers/application_controller.rb:11:in `current_user'
  app/controllers/home_controller.rb:3:in `index'

development 环境就没有错误,production 却有这些错误。

mongoid.yml

development:
  host: localhost
  database: myapppp_development

test:
  host: localhost
  database: myapppp_test

# set these environment variables on your prod server
production:
  uri: <%= ENV['MONGOHQ_URL'] %>

是不是这样的配置,就无法在开发机环境,运行 production 了?

db_name must be a string or symbol 数据库名称必须用字符串或者符号 #4 楼 没看明白。

#5 楼 @huacnlee

应该是说这个吧: production: uri: <%= ENV['MONGOHQ_URL'] %>

#6 楼 @bryanwong 这个环境变量在开发环境设置了吗?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号