from flask import Flask
import os
from app.extensions import db, migrate



def create_app():
    app = Flask(__name__)
    
    # Load configuration from config.py
    app.config.from_object('app.config')

    # Initialize extensions
    db.init_app(app)
    migrate.init_app(app, db)

    # Register blueprints or CLI commands here if needed
    from app.api.commands import commands
    app.cli.add_command(commands.upload_xls_cli)

    return app 