def register_extensions(app): """Register Flask extensions.""" cors.init_app(app) webpack.init_app(app) socketio.init_app(app, message_queue='redis://') db.init_app(app) if not get_debug_flag(): scheduler.init_app(app) scheduler.start() scheduler.run_job('missingcheck')
def _register_extensions(app): """ 注册组件 Args: app: Returns: """ socketio.init_app(app)
def create_app(): app = Flask('SingleAccountLogin') app.config.from_object(Config) db.init_app(app) socketio.init_app(app) login_manager.init_app(app) app.register_blueprint(demo_bp) return app
def register_extensions(app): from app.extensions import db from app.extensions import migrate from app.extensions import assets from app.extensions import socketio from app.extensions import login db.init_app(app) migrate.init_app(app, db) assets.init_app(app) socketio.init_app(app) login.init_app(app)
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) flask_static_digest.init_app(app) socketio.init_app(app) return None
def register_extensions(app: Flask): """Register Flask-Plugin modules""" assets.init_app(app) db.init_app(app) cache.init_app(app) mail.init_app(app) migrate.init_app(app, db) marshmallow.init_app(app) login.init_app(app) login.blueprint_login_views = {'auth': '/login'} from app.blueprints.term import events # necessary for socketio socketio.init_app(app, async_mode=None)
def run_as_socketio(app, args): """在socketio中运行""" from app.extensions import socketio socketio.init_app(app) socketio.run( app, host=args.bind, debug=args.debug, use_reloader=args.use_reloader, port=args.port, )
def register_extensions(app): """给Flask注册扩展功能""" bcrypt.init_app(app) cache.init_app(app) db.init_app(app) xtredis.init_app(app) # csrf_protect.init_app(app) login_manager.init_app(app) cors.init_app(app, resources=r'/*', supports_credentials=True) migrate.init_app(app, db) flask_static_digest.init_app(app) socketio.init_app(app, cors_allowed_origins='*', logger=True, engineio_logger=True) return None
def register_extensions(app): bootstrap.init_app(app) db.init_app(app) login_manager.init_app(app) login_manager.login_view = 'web.login' login_manager.login_message_category = 'warning' avatars.init_app(app) pagedown.init_app(app) #cache.init_app(app) mail.init_app(app) moment.init_app(app) csrf.init_app(app) socketio.init_app(app) oauth.init_app(app)
def register_extensions(app, content, config_object): """ Init extension :param app: :param content: :return: """ client.app = app client.init_app(app) socketio.init_app(app) # don't start extensions if content != app if content == 'app': jwt.init_app(app) # logger logger = logging.getLogger('api') logger.setLevel(logging.ERROR) logger.addHandler(app_log_handler) @app.after_request def after_request(response): # This IF avoids the duplication of registry in the log, # since that 500 is already logged via @app.errorhandler. if response.status_code != 500: ts = strftime('[%Y-%b-%d %H:%M]') logger.error('%s %s %s %s %s %s', ts, request.remote_addr, request.method, request.scheme, request.full_path, response.status) return response @app.errorhandler(Exception) def exceptions(e): ts = strftime('[%Y-%b-%d %H:%M]') tb = traceback.format_exc() error = '{} {} {} {} {} 5xx INTERNAL SERVER ERROR\n{}'.format \ ( ts, request.remote_addr, request.method, request.scheme, request.full_path, tb ) logger.error(error) return "Internal Server Error", 500
def register_extensions(app): """Register the Flask app with various extensions.""" bcrypt.init_app(app) ma.init_app(app) socketio.init_app(app)
def _register_extension(app): db.init_app(app) moment.init_app(app) csrf.init_app(app) socketio.init_app(app)
def register_extensions(app): db_sql.init_app(app) socketio.init_app(app)