Python : Bootstrap 4 快速版面設定
1 min readJun 3, 2017
製作css js檔案
copy paste to \template\html_reference.html
選定版面
檢視網頁原始碼 copy paste to \templates\base.html
在base.html中引用css js
{% include “html_reference.html”%}
{% include %} 引用 “html_reference.html”檔案名稱
/run.py 網頁呼叫 render_template
from flask import Flask,render_template
app = Flask(__name__)
@app.route(“/”)
def hello():
return render_template(“base.html”) #base.html是web 框架的位置
if __name__ == “__main__”:
app.run()
複製Bootstrap 4 css
這個位置的code
複製至 \static\css\style.css
to \template\html_reference.html 新增下行 css才會被吃得到
<link rel=”stylesheet” href=”{{url_for(‘static’,filename=’css/style.css’)}}”>
url_for() 檔案位置
url_for(資料夾,檔案名稱)