LoginSignup
4
0

More than 5 years have passed since last update.

Bottle で CSSを使う

Posted at

Bottle を触ってる途中
あれ?css使えん?
という事で、調べました。
これで静的ファイルがつかえます。

app.py
from bottle import get, static_file

# Static file
@get("/static/css/<filepath:re:.*\.css>")
def css(filepath):
    return static_file(filepath, root="static/css")

@get("/static/font/<filepath:re:.*\.(eot|otf|svg|ttf|woff|woff2?)>")
def font(filepath):
    return static_file(filepath, root="static/font")

@get("/static/img/<filepath:re:.*\.(jpg|png|gif|ico|svg)>")
def img(filepath):
    return static_file(filepath, root="static/img")

@get("/static/js/<filepath:re:.*\.js>")
def js(filepath):
    return static_file(filepath, root="static/js")

参考リンク

 

これで、平気かな、、、

たぶん

4
0
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
4
0