【发布时间】:2017-04-17 23:48:48
【问题描述】:
这是我遇到的一个非常奇怪的错误。我在轨道上使用红宝石。在本地(在云 9 上)一切正常,我成功地将其推送到 Heroku。我已经运行 db:migrate 没有错误。尽管如此,我收到错误“您要查找的页面不存在”并且日志显示 404。我检查了文件并且它们已正确上传。 我的路线:
root 'application#index'
get '/index/:type' => 'application#index'
get '/index/' => 'application#index'
get '/benchmark/' => 'application#benchmark'
get '/benchmark/:type' => 'application#benchmark'
get '/benchmarkupdate/:name' => 'application#benchmark'
get '/indexupdate/:name' => 'application#index'
我的文件位于正确的位置。我认为路由没有任何问题,并且它在本地工作。
Heroku 日志:
2017-04-18T03:13:14.455398+00:00 app[web.1]: * Version 3.8.2 (ruby 2.3.4-p301), codename: Sassy Salamander
2017-04-18T03:13:14.455399+00:00 app[web.1]: * Min threads: 5, max threads: 5
2017-04-18T03:13:14.455399+00:00 app[web.1]: * Environment: production
2017-04-18T03:13:15.493228+00:00 app[web.1]: DEPRECATION WARNING: `config.serve_static_files` is deprecated and will be removed in Rails 5.1.
2017-04-18T03:13:15.493241+00:00 app[web.1]: Please use `config.public_file_server.enabled = true` instead.
2017-04-18T03:13:15.493243+00:00 app[web.1]: (called from block in <top (required)> at /app/config/environments/production.rb:25)
2017-04-18T03:13:16.337785+00:00 app[web.1]: * Listening on tcp://0.0.0.0:49146
2017-04-18T03:13:16.337997+00:00 app[web.1]: Use Ctrl-C to stop
2017-04-18T03:13:16.847301+00:00 heroku[web.1]: State changed from starting to up
2017-04-18T03:13:18.094441+00:00 heroku[router]: at=info method=GET path="/" host=protected-coast-54392.herokuapp.com request_id=3d8c7a3f-3f40-4747-862f-7e70e7c9029e fwd="152.3.34.25" dyno=web.1 connect=1ms service=75ms status=404 bytes=1744 protocol=https
还有其他可能导致此问题的原因吗?
【问题讨论】:
-
欢迎使用stackoverflow,请将相关代码和日志作为文本添加到问题本身。不是截图。工具栏上有一个
{}按钮,用于将文本格式化为代码。 -
@Xlsaax 我在 Heroku 日志中没有看到堆栈跟踪或任何有用的信息。是否有类似 WEBrick 错误的堆栈跟踪?
标签: ruby-on-rails ruby heroku routes