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 %} - - - -

Hello World!

- - 404 - - + Your page title + {% endblock %} + + + + {% block content %} + + + + + + + + + {% endblock %} + {% block scripts %} + + {{ bootstrap.load_js() }} + {% endblock %} + \ No newline at end of file diff --git a/python_web/flasky/templates/user.html b/python_web/flasky/templates/user.html index 2b98916..db70313 100644 --- a/python_web/flasky/templates/user.html +++ b/python_web/flasky/templates/user.html @@ -1,13 +1,47 @@ -

Hello {{ name }}!

+ - + + - + - \ No newline at end of file + + +{% extends "bootstrap/base.html" %} + +{% block title %}Flasky{% endblock %} + +{% block navbar %} + +{% endblock %} + +{% block content %} +
+ +
+{% endblock %} \ No newline at end of file