【发布时间】:2016-11-03 23:39:32
【问题描述】:
我启动了rails服务器
$ bundle exec rails s -p 3001
=> Booting WEBrick
=> Rails 4.2.5 application starting in development on http://localhost:3001
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2016-11-03 19:29:30] INFO WEBrick 1.3.1
[2016-11-03 19:29:30] INFO ruby 2.2.5 (2016-04-26) [x86_64-darwin15]
[2016-11-03 19:29:30] INFO WEBrick::HTTPServer#start: pid=30949 port=3001
但是当我转到http://localhost:3001 时出现错误:找不到此本地主机页面
这是我继续http://locahhost:3001 后在终端看到的数据 知道有什么问题吗?
{
"timestamp": "2016-11-03T23:35:40Z",
"severity": "DEBUG",
"type": "none",
"message": " \u001b[1m\u001b[36mSQL (57.9ms)\u001b[0m \u001b[1mUSE [peak]\u001b[0m"
}
{
"timestamp": "2016-11-03T23:35:40Z",
"severity": "INFO",
"type": "database.query",
"request_id": "67b064b7-f6a3-414e-9a39-da4f851fc8dd",
"connection_id": "70230967245540",
"event": "SQL",
"query_id": "a15f740d4daad1a81dbc7e0df1ccf3e5",
"query": "USE [peak]",
"duration": "58.3"
}
{
"timestamp": "2016-11-03T23:35:40Z",
"severity": "INFO",
"type": "none",
"message": "Processing by HomeController#index as HTML"
}
{
"timestamp": "2016-11-03T23:35:40Z",
"severity": "INFO",
"type": "none",
"message": " Rendered text template (0.0ms)"
}
{
"timestamp": "2016-11-03T23:35:40Z",
"severity": "INFO",
"type": "view.render",
"request_id": "67b064b7-f6a3-414e-9a39-da4f851fc8dd",
"template": "text template",
"layout": null,
"duration": "0.4"
}
{
"timestamp": "2016-11-03T23:35:40Z",
"severity": "INFO",
"type": "none",
"message": "Completed 404 Not Found in 9ms (Views: 8.1ms | ActiveRecord: 0.0ms)"
}
{
"timestamp": "2016-11-03T23:35:40Z",
"severity": "INFO",
"type": "application.request",
"request_id": "67b064b7-f6a3-414e-9a39-da4f851fc8dd",
"method": "GET",
"status": 404,
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36",
"referrer": null,
"forwarded_for": null,
"url_scheme": "http",
"url_host": "localhost",
"url_port": "3001",
"url_path": "/",
"url_query": null,
"rails_controller": "home",
"rails_action": "index",
"clean_path": "/",
"remote_ip": "::1",
"remote_host": "::1",
"duration": "1108.02",
"message": "Not Found",
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"content_type": "text/plain; charset=utf-8"
}
【问题讨论】:
-
您的日志包括
Completed 404 Not Found in 9ms,看起来您的应用运行良好,但您提供的路径没有路径。你期待看到什么? -
你的路线有什么?最后一条消息说“home#index”是“未找到”,所以路线是开始寻找的好地方......然后......你有一个带有索引操作的家庭控制器(是下一个寻找的地方) .
标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4 ruby-on-rails-3.2