Esempio n. 1
0
def register_extensions(app):
    bcrypt.init_app(app)
    db.init_app(app)
    csrf_protect.init_app(app)
    login.init_app(app)
    debug_toolbar.init_app(app)
    mail.init_app(app)
    migrate.init_app(app, db)
    moment.init_app(app)
    if not app.debug and not app.testing:
        if app.config['MAIL_SERVER']:
            auth = None
            if app.config['MAIL_USERNAME'] or app.config['MAIL_PASSWORD']:
                auth = (app.config['MAIL_USERNAME'],
                        app.config['MAIL_PASSWORD'])
            secure = None
            if app.config['MAIL_USE_TLS']:
                secure = ()
            mail_handler = SMTPHandler(
                mailhost=(app.config['MAIL_SERVER'], app.config['MAIL_PORT']),
                fromaddr='no-reply@' + app.config['MAIL_SERVER'],
                toaddrs=app.config['ADMINS'], subject='Microblog Failure',
                credentials=auth, secure=secure)
            mail_handler.setLevel(logging.ERROR)
            app.logger.addHandler(mail_handler)
    return None
Esempio n. 2
0
def register_extensions(app):
    csrf_protect.init_app(app)
    login_manager.init_app(app)
    bootstrap.init_app(app)
    db.init_app(app)
    migrate.init_app(app, db)
    return None
Esempio n. 3
0
def register_extensions(app):
    bcrypt.init_app(app)
    db.init_app(app)
    csrf_protect.init_app(app)
    login.init_app(app)
    migrate.init_app(app, db)
    moment.init_app(app)
    return None
Esempio n. 4
0
def register_extensions(app):
    """Register Flask extensions."""
    bcrypt.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    csrf_protect.init_app(app)
    login_manager.init_app(app)
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    return None
Esempio n. 5
0
def register_extensions(app):
    bcrypt.init_app(app)
    db.init_app(app)
    csrf_protect.init_app(app)
    login.init_app(app)
    migrate.init_app(app, db)
    moment.init_app(app)
    configure_uploads(app, images)
    patch_request_class(app)
    return None
Esempio n. 6
0
def register_extensions(app):
    """register Flask extensions."""
    bcrypt.init_app(app)
    csrf_protect.init_app(app)
    login_manager.init_app(app)
    db.init_app(app)
    migrate.init_app(app, db)
    cache.init_app(app)
    debug_toolbar.init_app(app)
    flask_static_digest.init_app(app)
Esempio n. 7
0
def register_extensions(app):
    """Register Flask extensions."""
    assets.init_app(app)
    bcrypt.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    csrf_protect.init_app(app)
    login_manager.init_app(app)
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    return None
Esempio n. 8
0
def register_extensions(app):
    babel.init_app(app)
    bcrypt.init_app(app)
    bootstrap.init_app(app)
    cache.init_app(app)
    db.init_app(app)
    csrf_protect.init_app(app)
    login_manager.init_app(app)
    debug_toolbar.init_app(app)
    migrate.init_app(app, db)
    mail.init_app(app)
    moment.init_app(app)
Esempio n. 9
0
def register_extensions(app):
    bcrypt.init_app(app)
    db.init_app(app)
    csrf_protect.init_app(app)
    login.init_app(app)
    migrate.init_app(app, db)
    KVSessionExtension(store, app)
    babel = Babel(app)
    mail.init_app(app)

    @babel.localeselector
    def get_locale():
        # return 'ja'
        return request.accept_languages \
            .best_match(current_app.config['LANGUAGES'])

    return None
Esempio n. 10
0
import config

from app.extensions import (bcrypt, csrf_protect, db, login, mail)

from flask import (Flask)

app = Flask(__name__)

app.config.from_object('config.Development')

app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

bcrypt.init_app(app)
db.init_app(app)
csrf_protect.init_app(app)
login.init_app(app)
mail.init_app(app)

from app.admin.admin import admin
from app.api import api
from app.blog.blog import blog
from app.main.main import intro
from app.commer.commer import commer
from app.disp.disp import disp
from app.employ.employ import employ
from app.priv.priv import priv
from app.prop.prop import prop
from app.team.team import team
from app.tele.tele import tele
Esempio n. 11
0
def register_extensions(app):
    """Register Flask extensions."""
    bcrypt.init_app(app)
    cache.init_app(app)
    csrf_protect.init_app(app)
    return None