当前位置: 首页>>代码示例>>Python>>正文


Python flask_bootstrap.Bootstrap方法代码示例

本文整理汇总了Python中flask_bootstrap.Bootstrap方法的典型用法代码示例。如果您正苦于以下问题:Python flask_bootstrap.Bootstrap方法的具体用法?Python flask_bootstrap.Bootstrap怎么用?Python flask_bootstrap.Bootstrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_bootstrap的用法示例。


在下文中一共展示了flask_bootstrap.Bootstrap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: worker

# 需要导入模块: import flask_bootstrap [as 别名]
# 或者: from flask_bootstrap import Bootstrap [as 别名]
def worker(port):
    app = Flask(__name__)
    # FIXME: use hexlified hsm secret or something else
    app.config['SECRET_KEY'] = 'you-will-never-guess-this'
    app.add_url_rule('/donation', 'donation',
                     donation_form, methods=["GET", "POST"])
    app.add_url_rule('/is_invoice_paid/<label>', 'ajax', ajax)
    bootstrap = Bootstrap(app)
    app.run("0.0.0.0", port=port)
    return 
开发者ID:lightningd,项目名称:plugins,代码行数:12,代码来源:donations.py

示例2: create_app

# 需要导入模块: import flask_bootstrap [as 别名]
# 或者: from flask_bootstrap import Bootstrap [as 别名]
def create_app(configfile=None):
    # We are using the "Application Factory"-pattern here, which is described
    # in detail inside the Flask docs:
    # http://flask.pocoo.org/docs/patterns/appfactories/


    APPLICATION_ROOT = '/%s' % os.environ['ANTIDOTE_FULL_REF']

    app = Flask(__name__)

    # We use Flask-Appconfig here, but this is not a requirement
    AppConfig(app)

    # Install our Bootstrap extension
    Bootstrap(app)

    # Our application uses blueprints as well; these go well with the
    # application factory. We already imported the blueprint, now we just need
    # to register it:
    app.register_blueprint(frontend)

    # Because we're security-conscious developers, we also hard-code disabling
    # the CDN support (this might become a default in later versions):
    app.config['BOOTSTRAP_SERVE_LOCAL'] = True

    # We initialize the navigation as well
    nav.init_app(app)

    return app 
开发者ID:nre-learning,项目名称:nrelabs-curriculum,代码行数:31,代码来源:__init__.py


注:本文中的flask_bootstrap.Bootstrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。