0

我在本地运行 Sinatra 应用程序,它运行良好,但我无法将应用程序部署到 heroku 或 EC2。我在我的日志(本地)中得到以下关于 favicon.ico 的信息。我已将此文件添加到我的应用程序中,但它仍然给了我这个:

ActiveRecord::RecordNotFound - 找不到 id=favicon.ico 的位置

有想法该怎么解决这个吗?

== Sinatra/1.4.2 has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.5.1 codename Straight Razor)
>> Maximum connections set to 1024
>> Listening on localhost:4567, CTRL+C to stop
D, [2013-06-06T20:18:30.470678 #1786] DEBUG -- :   Location Load (0.2ms)  SELECT "locations".*        FROM "locations" 
127.0.0.1 - - [06/Jun/2013 20:18:30] "GET / HTTP/1.1" 200 2552 0.0419
D, [2013-06-06T20:18:30.763844 #1786] DEBUG -- :   Location Load (0.2ms)  SELECT "locations".*   FROM "locations" WHERE "locations"."id" = ? LIMIT 1  [["id", "favicon.ico"]]
ActiveRecord::RecordNotFound - Couldn't find Location with id=favicon.ico:
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord- 3.2.13/lib/active_record/relation/finder_methods.rb:343:in `find_one'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:314:in `find_with_ids'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/relation/finder_methods.rb:107:in `find'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.13/lib/active_record/querying.rb:5:in `find'
app.rb:36:in `block in <main>'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1415:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1415:in `block in compile!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `[]'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (3 levels) in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:960:in `route_eval'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:944:in `block (2 levels) in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:981:in `block in process_route'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:979:in `process_route'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:943:in `block in route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `each'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:942:in `route!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1053:in `block in dispatch!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1050:in `dispatch!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `block in call!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `block in invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1035:in `invoke'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:878:in `call!'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:864:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/logger.rb:15:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/commonlogger.rb:33:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:209:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:202:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/showexceptions.rb:21:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:172:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1947:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `block in call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1693:in `synchronize'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/sinatra-1.4.2/lib/sinatra/base.rb:1610:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:79:in `catch'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `call'
/Users/Home/.rvm/gems/ruby-1.9.3-p374/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `block in spawn_threadpool'
4

1 回答 1

0

您是否有一条/:something路线,然后尝试从基于:something. 似乎浏览器正在请求/favicon.ico并且您的应用程序正在尝试查询数据库以获取具有 id 的记录favicon.ico

你有/:something路线吗?如果有,它有什么作用?

于 2013-06-11T01:48:17.253 回答