本文整理汇总了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