LoginSignup
0
2

More than 3 years have passed since last update.

python Bottle chrome icon エラーが出たとき!

Posted at

python Bottle chrome icon エラーが出たとき!

Failed to load resource: the server responded with a status of 404 (Not Found)

image.png

なんとも気分の悪いエラーである。
「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
│

image.png

はい消えたよ!
「いいよね」してね。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2