本文整理匯總了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
示例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