text: from flask import Flask
  from flask_login import LoginManager
  from flask_migrate import Migrate
  from flask_sqlalchemy import SQLAlchemy
  from flask_wtf.csrf import CSRFProtect
  
  from config import Config
  
  db = SQLAlchemy()
  migrate = Migrate()
  login = LoginManager()
  csrf = CSRFProtect()
  
  
  def init_app():
      """Initialize the core application"""
      app = Flask(__name__, instance_relative_config=False)
      app.config.from_object(Config)
      db.init_app(app)
      migrate.init_app(app, db)
      login.init_app(app)
      csrf.init_app(app)
  
      with app.app_context():
          from . import routes, models
          app.register_blueprint(routes.router)
  
          return app
  