""" Flask application initialization """ from flask import Flask, send_from_directory from flask_cors import CORS from pathlib import Path from app.config import Config from app.routes.video_routes import video_bp from app.utils.logger import setup_logger def create_app(config_class=Config): """ Create and configure Flask application Args: config_class: Configuration class Returns: Flask application instance """ # Get project root directory project_root = Path(__file__).parent.parent static_folder = project_root / 'static' app = Flask(__name__, static_folder=str(static_folder), static_url_path='/static') app.config.from_object(config_class) # Enable CORS for frontend access CORS(app) # Setup logger setup_logger(app) # Register blueprints app.register_blueprint(video_bp, url_prefix='/api/videos') # Serve index.html at root @app.route('/') def index(): """Serve index.html at root""" return send_from_directory(static_folder, 'index.html') return app