# -*- coding: utf-8 -*-

"""
--------------------------------------
@File       : ext.py
@Author     : maixiaochai
@Email      : <EMAIL>
@Created on : 2020/4/27 14:03
--------------------------------------
"""

from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_session import Session
from flask_caching import Cache
from flask_debugtoolbar import DebugToolbarExtension
from flask_mail import Mail

# SQLAlchemy 创建数据表，模型结构的修改，不会被映射到对应的数据表
# Migrate 作用是将models的结构修改映射到数据库中
models = SQLAlchemy()
migrate = Migrate()
mail = Mail()
cache = Cache(config={
    "CACHE_TYPE": "simple"
})
# toolbar = DebugToolbarExtension()


def init_ext(app):
    models.init_app(app)
    migrate.init_app(app, models)
    Session(app)
    # toolbar.init_app(app)
    cache.init_app(app)
    mail.init_app(app)


# -*- coding: utf-8 -*-

"""
--------------------------------------
@File       : ext.py
@Author     : maixiaochai
@Email      : <EMAIL>
@Created on : 2020/4/27 14:03
--------------------------------------
"""

from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_session import Session
from flask_caching import Cache
from flask_debugtoolbar import DebugToolbarExtension
from flask_mail import Mail

# SQLAlchemy 创建数据表，模型结构的修改，不会被映射到对应的数据表
# Migrate 作用是将models的结构修改映射到数据库中
models = SQLAlchemy()
migrate = Migrate()
mail = Mail()
cache = Cache(config={
    "CACHE_TYPE": "simple"
})
# toolbar = DebugToolbarExtension()


def init_ext(app):
    models.init_app(app)
    migrate.init_app(app, models)
    Session(app)
    # toolbar.init_app(app)
    cache.init_app(app)
    mail.init_app(app)


# -*- coding: utf-8 -*- -------------------------------------- @File       : ext.py @Author     : maixiaochai @Email      : <EMAIL> @Created on : 2020/4/27 14:03 -------------------------------------- # SQLAlchemy 创建数据表，模型结构的修改，不会被映射到对应的数据表 # Migrate 作用是将models的结构修改映射到数据库中 # toolbar = DebugToolbarExtension() # toolbar.init_app(app)