python Bottle chrome icon エラーが出たとき!
Failed to load resource: the server responded with a status of 404 (Not Found)
なんとも気分の悪いエラーである。
「icoファイルがないというエラー」
icoファイルを作ったけどどこに入れればいいの!
解決方法いろいろあるが、Bottleの立場に立って考えよう。
bottle.py
from bottle import *
@route('/favicon.ico')
def favcon():
return static_file('favicon.ico', root='./static')
favicon.icoを呼びに来た時にstaticフォルダの下に置いたicoをロードしてあげよう。
C:.
│ app.py
│ bottle4j_ico.pyproj
│ bottle4j_ico.pyproj.user
│ requirements.txt
│ routes.py
├─static
│ │ favicon.ico ### ここにICOファイルを配置
│ ├─content
│ │ bootstrap-grid.css
│ │ bootstrap-grid.css.map
│ │ bootstrap-grid.min.css
│ │ bootstrap-grid.min.css.map
│ │ bootstrap-reboot.css
│ │ bootstrap-reboot.css.map
│ │ bootstrap-reboot.min.css
│ │ bootstrap-reboot.min.css.map
│ │ bootstrap.css
│ │ bootstrap.css.map
│ │ bootstrap.min.css
│ │ bootstrap.min.css.map
│ │ jumbotron.css
│ │ site.css
│ │
│ ├─fonts
│ │ glyphicons-halflings-regular.eot
│ │ glyphicons-halflings-regular.svg
│ │ glyphicons-halflings-regular.ttf
│ │ glyphicons-halflings-regular.woff
│ │
│ └─scripts
│ bootstrap.bundle.js
│ bootstrap.bundle.js.map
│ bootstrap.bundle.min.js
│ bootstrap.bundle.min.js.map
│ bootstrap.js
│ bootstrap.js.map
│ bootstrap.min.js
│ bootstrap.min.js.map
│ jquery-1.10.2.intellisense.js
│ jquery-1.10.2.js
│ jquery-1.10.2.min.js
│ jquery-1.10.2.min.map
│ jquery.validate-vsdoc.js
│ jquery.validate.js
│ jquery.validate.min.js
│ jquery.validate.unobtrusive.js
│ jquery.validate.unobtrusive.min.js
│ modernizr-2.6.2.js
│ respond.js
│ respond.min.js
│ _references.js
│
├─views
│ about.tpl
│ contact.tpl
│ index.tpl
│ layout.tpl
│
はい消えたよ!
「いいよね」してね。