????????Flask???????????Flask????????????????????????????????????????????????????Flask?????????????????????????????????
??????????Flask-Bootstrap?????????????????????????????????????????????????????????????????????????
???????????
???????
??????????????easy_install??pip????????pip??
????pip install ?????
????????????????????“flask-ability”???????ability???????????????????????flask-script??flask-bootstrap??
????pip install flask-bootstrap
????????
?????????????е???????????????“flask_ability”??
????from flask_bootstrap import Bootstrap
????????
????????????ú?Flask???????????????????????????洢???????????????????????д?????????????????????????????????????????????Flask??????á?
?????????
???????????????????????
????1????????????
?????????С???????????????????????????????????????“app”????
????from flask import Flask
????from flask_bootstrap import Bootstrap
????app = Flask(__name__)
????bootstrap = Bootstrap(app)
????2????ó????????
?????????????????????????????? init_app ???????????????????????????????????????????????????????
????flask_bootstrap/__init__.py
????class Bootstrap(object):
????def __init__(self?? app=None):
????if app is not None:
????self.init_app(app)
????def init_app(self?? app):
????app.config.setdefault('BOOTSTRAP_USE_MINIFIED'?? True)
????app.config.setdefault('BOOTSTRAP_CDN_FORCE_SSL'?? False)
????...
???????????????????????????????????????Bootstrap??????????????????????init_app()??????
????????ù??????????????????????????????????????
????from flask import Flask
????from flask_bootstrap import Bootstrap
????from config import config
????bootstrap = Bootstrap()  # ????????????
????def create_app():
????app = Flask(__name__)
????app.config.from_object(config)
????bootstrap.init_app(app)
????return app
????????????????????????????????????????????????app = create_app()???????????????
????????
????????С????????????????????????????????????????????????????????????????
????1?????????????create_app()?????????
??????????????????????app/__init__.py??????????????????????app.py????????????????Ρ?
????2????????????????
?????????????????????????????????????????????????????????????????????????????????????????????extensions.py??
????extensions.py
????from flask_bootstrap import Bootstrap
????bootstrap = Bootstrap()  # ????????????
??????????????????create_app()????????
????from flask import Flask
????from extensions import bootstrap
????from config import config
????def create_app():
????app = Flask(__name__)
????app.config.from_object(config)
????bootstrap.init_app(app)
????return app
???????????????????????е??????????????е???????????init_app???????????????????flask-bootstrap??????????????flask_bootstrap????????????????????Bootstrap????????????????????????????????????Flask????????????????……