我对 ruby 和 rails 有几个星期的了解……但我是一位经验丰富的程序员。
我已将我的 POC 应用程序迁移到 heroku。
该应用程序在那里。我看到了标准的 ruby 登陆页面:
http://pacific-lake-7797.herokuapp.com/
当我点击我的 POC 页面时:
http://pacific-lake-7797.herokuapp.com/user_stories
我得到:
您要查找的页面不存在。
您可能输入了错误的地址或页面可能已移动。
我在日志中看到了这个:
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m Started GET
"/user_stories" for 66.31.53.52 at 2013-03-13 00:08:00 +0000
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/
active_support/inflector/methods.rb:230:in `block in constantize'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m
vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/
active_support/inflector/methods.rb:229:in `each'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m
ActionController::RoutingError (uninitialized constant UserStoriesController):
对我来说,问题似乎很明显与此日志消息有关:
ActionController::RoutingError (uninitialized constant UserStoriesController):
但到目前为止,我还没有找到任何可以解释这可能意味着什么的东西。
这是我尝试过的(在很大程度上感谢大家!)
DB看起来不错
我跑了 rake db:migrate 并且日志看起来不错。我还可以从本地 postgres 管理员访问数据库。该页面实际上还没有访问数据库,但数据库在那里。
config.assets.compile
我将此设置更改为true:
config.assets.compile = true
本地生产运行良好
我以生产模式启动服务器...
rails server -e production
一切正常。
耙路线
如果我跑
heroku run "rake routes"
我想我看到我的路线还可以。警告似乎正在为我认为尚未使用的 rails 4.0 做准备。
结果:
$ heroku run "rake routes"
Running `rake routes` attached to terminal... up, run.6943
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support
for these plugins will be removed in Rails 4.0. Move them out and bundle them i
n your Gemfile, or fold them in to your app as lib/myplugin/* and config/initial
izers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonr
ails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required
)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support
for these plugins will be removed in Rails 4.0. Move them out and bundle them i
n your Gemfile, or fold them in to your app as lib/myplugin/* and config/initial
izers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonr
ails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required
)> at /app/Rakefile:7)
user_stories GET /user_stories(.:format) user_stories#index
POST /user_stories(.:format) user_stories#create
new_user_story GET /user_stories/new(.:format) user_stories#new
edit_user_story GET /user_stories/:id/edit(.:format) user_stories#edit
user_story GET /user_stories/:id(.:format) user_stories#show
PUT /user_stories/:id(.:format) user_stories#update
DELETE /user_stories/:id(.:format) user_stories#destroy
这是记录的完整日志
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m Started GET "/user_stories" for 66.31.53.52 at 2013-03-13 00:08:00 +0000
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:230:in `block in constantize'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:229:in `each'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m ActionController::RoutingError (uninitialized constant UserStoriesController):
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:229:in `constantize'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:54:in `controller'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:69:in `controller_reference'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:32:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/routing/route_set.rb:601:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/head.rb:14:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/flash.rb:242:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/cookies.rb:341:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/query_cache.rb:64:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `_run__4347238382960990098__call__3337526573215554696__callba
cks'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:32:in `call_app'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:16:in `block in call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/tagged_logging.rb:22:in `tagged'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/logger.rb:16:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/request_id.rb:22:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:62:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:479:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/application.rb:223:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m vendor/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/rack/log_tailer.rb:17:in `call'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
←[36m2013-03-13T00:08:00+00:00 app[web.1]:←[0m
←[33m2013-03-13T00:08:00+00:00 heroku[router]:←[0m at=info method=GET path=/user_stories host=pacific-lake-7797.herokuapp.com fwd="66.31.53.52" dyno=web.1 queue=0 wait=0ms connect=10ms service=31ms st
atus=404 bytes=728
谢谢!
在此先感谢您……以及您已经为我回答的数百个其他问题!