我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用flask_bootstrap.Bootstrap()。
def create_app(): # See http://flask.pocoo.org/docs/patterns/appfactories app = flask.Flask(__name__) nav.nav.init_app(app) flask_dotenv.DotEnv().init_app(app, verbose_mode = True) flask_bootstrap.Bootstrap(app) app.register_blueprint(frontend) app.config['BOOTSTRAP_SERVE_LOCAL'] = True app.config['TEMPLATES_AUTO_RELOAD'] = True return app
def create_app(): """Create the Flask app with Bootstrap requirements. :return: The Flask app object """ app = Flask(__name__) Bootstrap(app) cache.init_app(app) return app
def create_app(configfile=None): """ Application Factory - see http://flask.pocoo.org/docs/patterns/appfactories/ """ app = Flask(__name__) app.config['SECRET_KEY'] = 'NOT SO SECRET' if config.SERVER_NAME: app.config['SERVER_NAME'] = config.SERVER_NAME # https://pythonhosted.org/Flask-Bootstrap/ Bootstrap(app) # Load blueprints # http://flask.pocoo.org/docs/0.12/blueprints/ # Website app.register_blueprint(frontend) # API endpoints app.register_blueprint(api, url_prefix='/api') # http://pythonhosted.org/flask-nav/ nav.init_app(app) return app
def create_app(config_name): app = flask.Flask(__name__) app.config.from_object(config[config_name]) db.init_app(app) cache.init_app(app) config[config_name].init_app(app) flask_bootstrap.Bootstrap(app) app.register_blueprint(scoreboard) app.register_blueprint(error_pages) return app