Python flask_bootstrap.Bootstrap() Examples

The following are 2 code examples of flask_bootstrap.Bootstrap(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module flask_bootstrap , or try the search function .
Example #1
Source File: donations.py    From plugins with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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 
Example #2
Source File: __init__.py    From nrelabs-curriculum with Apache License 2.0 5 votes vote down vote up
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