From 8f280a0aa1e95b198604edb68548a41bba3bb3c7 Mon Sep 17 00:00:00 2001 From: liukai234 <2679327337@qq.com> Date: Sun, 31 May 2020 14:35:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8bootstrip=5Fflask=E4=BB=A5?= =?UTF-8?q?=E9=80=82=E9=85=8Dbootstrip4.x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python_web/flasky/README.md | 7 ++- python_web/flasky/template.py | 2 + python_web/flasky/templates/index.html | 59 ++++++++++++++++++++------ python_web/flasky/templates/user.html | 48 ++++++++++++++++++--- 4 files changed, 96 insertions(+), 20 deletions(-) diff --git a/python_web/flasky/README.md b/python_web/flasky/README.md index a083b96..0e47cc5 100644 --- a/python_web/flasky/README.md +++ b/python_web/flasky/README.md @@ -6,4 +6,9 @@ ## 激活虚拟环境 - source venv/bin/activate ## 退出虚拟环境 -- deactivate \ No newline at end of file +- deactivate +## 调整包搜索路径到虚拟环境中 +- 更改PYTHONPATH环境变量 +- export PYTHONPATH=$PYTHONPATH:/home/lk234/pyFile/python_web/flasky/venv/lib/python3.6/site-packages +- 检查$PATHONPATH中是否有增加的路径 +- [注] 仅适用于当前终端 \ No newline at end of file diff --git a/python_web/flasky/template.py b/python_web/flasky/template.py index 023a605..a70bfeb 100644 --- a/python_web/flasky/template.py +++ b/python_web/flasky/template.py @@ -2,8 +2,10 @@ # Jinja2 模板引擎 from flask import Flask, render_template +from flask_bootstrap import Bootstrap app = Flask(__name__) +bootstrap = Bootstrap(app) @app.route('/') def index(): diff --git a/python_web/flasky/templates/index.html b/python_web/flasky/templates/index.html index 911aa95..25caf35 100644 --- a/python_web/flasky/templates/index.html +++ b/python_web/flasky/templates/index.html @@ -1,16 +1,51 @@ - - + + +
+ {% block head %} + + + - + {% block styles %} + + {{ bootstrap.load_css() }} + {% endblock %} - - - -