當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。