Exemplo n.º 1
0
def register_extensions(app):
    test_assets.init_app(app) if app.config.get('TESTING') else assets.init_app(app)
    bcrypt.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    login_manager.init_app(app)
    login_manager.anonymous_user = AnonymousUser
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    admin.init_app(app)
    s3.init_app(app)
    mail.init_app(app)
    return None
Exemplo n.º 2
0
def register_extensions(app):
    test_assets.init_app(app) if app.config.get(
        'TESTING') else assets.init_app(app)
    bcrypt.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    login_manager.init_app(app)
    login_manager.anonymous_user = AnonymousUser
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    admin.init_app(app)
    s3.init_app(app)
    mail.init_app(app)
    return None
Exemplo n.º 3
0
def register_extensions(app):
    test_assets.init_app(app) if app.config.get('TESTING') else assets.init_app(app)
    bcrypt.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    login_manager.init_app(app)
    login_manager.anonymous_user = AnonymousUser
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    admin.init_app(app)
    s3.init_app(app)
    mail.init_app(app)

    from flask_sslify import SSLify
    # only trigger SSLify if the app is running on Heroku
    if 'DYNO' in os.environ:
        SSLify(app)
    return None
def register_extensions(app):
    test_assets.init_app(app) if app.config.get(
        'TESTING') else assets.init_app(app)
    bcrypt.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    login_manager.init_app(app)
    from purchasing.users.models import AnonymousUser
    login_manager.anonymous_user = AnonymousUser
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    admin.init_app(app)
    s3.init_app(app)
    mail.init_app(app)

    from flask_sslify import SSLify
    # only trigger SSLify if the app is running on Heroku
    if 'DYNO' in os.environ:
        SSLify(app)
    return None
Exemplo n.º 5
0
def register_extensions(app):
    test_assets.init_app(app) if app.config.get(
        'TESTING') else assets.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    admin.init_app(app)
    s3.init_app(app)

    from purchasing.users.forms import ExtendedRegisterForm
    from purchasing.users.models import AnonymousUser, User, Role

    user_datastore = SQLAlchemyUserDatastore(db, User, Role)
    security_ctx = security.init_app(
        app,
        user_datastore,
        register_form=ExtendedRegisterForm,
        confirm_register_form=ExtendedRegisterForm,
        anonymous_user=AnonymousUser)
    mail.init_app(app)

    from purchasing.tasks import send_email

    @security_ctx.send_mail_task
    def async_security_email(msg):
        send_email([msg])

    app.config['SECURITY_MSG_UNAUTHORIZED'] = (
        'You do not have sufficent permissions to do that! If you are city staff, make sure you are logged in using the link to the upper right.',
        'alert-warning',
    )

    from flask_sslify import SSLify
    # only trigger SSLify if the app is running on Heroku
    if 'DYNO' in os.environ:
        SSLify(app)

    return None
def register_extensions(app):
    test_assets.init_app(app) if app.config.get('TESTING') else assets.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    admin.init_app(app)
    s3.init_app(app)

    from purchasing.users.forms import ExtendedRegisterForm
    from purchasing.users.models import AnonymousUser, User, Role

    user_datastore = SQLAlchemyUserDatastore(db, User, Role)
    security_ctx = security.init_app(
        app, user_datastore,
        register_form=ExtendedRegisterForm,
        confirm_register_form=ExtendedRegisterForm,
        anonymous_user=AnonymousUser)
    mail.init_app(app)

    from purchasing.tasks import send_email
    @security_ctx.send_mail_task
    def async_security_email(msg):
        send_email([msg])

    app.config['SECURITY_MSG_UNAUTHORIZED'] = (
        'You do not have sufficent permissions to do that! If you are city staff, make sure you are logged in using the link to the upper right.',
        'alert-warning',
    )

    from flask_sslify import SSLify
    # only trigger SSLify if the app is running on Heroku
    if 'DYNO' in os.environ:
        SSLify(app)

    return None