def configure_extensions(app): """ 注册插件 :param app: :return: """ db.init_app(app) migrate.init_app(app, db)
def register_extensions(app): """Register Flask extensions.""" db.init_app(app) debug_toolbar.init_app(app) migrate.init_app(app, db) Marshmallow(app) return None
def register_extensions(app): bcrypt.init_app(app) cache.init_app(app) db.init_app(app) csrf_protect.init_app(app) login_manager.init_app(app) migrate.init_app(app, db) socketio.init_app(app, async_mode='eventlet', message_queue=app.config['REDIS_URL']) return None
def configure_extensions(app): ''' Configure extensions ''' bcrypt.init_app(app) babel.init_app(app) cache.init_app(app) mail.init_app(app) db.init_app(app) if app.debug: try: from flask_debugtoolbar import DebugToolbarExtension debugtoolbar = DebugToolbarExtension(app) except ImportError, e: pass
def register_extensions(app): db.init_app(app) jwt.init_app(app) # 初始的identity为实例本身,再次自定义user_identity_handler # 设置为用户的user_code # 另一种注册方式,查看app.py里 # @jwt.user_identity_loader,下面自定义函数亦可 # 两种方式均可实现自定义的identity jwt.user_identity_loader(user_indetity_handler) # 初始化注册,表示的是使用自定义的回调函数 # 相关功能的初始化,应用调用是才会实例化 # 初始没有当前用户,自定义返回当前的用户 jwt.user_loader_callback_loader(user_loader_handler)
def register_extensions(app): """Register Flask extensions.""" db.init_app(app) migrate.init_app(app, db) return None