From 1c34dcbd283b833668b5722c6d60e8540c050919 Mon Sep 17 00:00:00 2001 From: Nguyen HP Laptop Date: Sun, 31 May 2026 10:55:24 -0400 Subject: [PATCH] 05/31 Phase 1: refactor 3 --- __init__.py | 55 ----------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 __init__.py diff --git a/__init__.py b/__init__.py deleted file mode 100644 index 83afea9..0000000 --- a/__init__.py +++ /dev/null @@ -1,55 +0,0 @@ -import os -from flask import Flask -from app.config import config -from app.extensions import db, login_manager, migrate, csrf -from app.utils.formatters import format_currency, format_percent, format_large_number - - -def create_app(config_name=None): - if config_name is None: - config_name = os.environ.get('FLASK_ENV', 'development') - if config_name == 'production': - config_name = 'production' - else: - config_name = 'development' - - app = Flask(__name__) - app.config.from_object(config[config_name]) - - # Init extensions - db.init_app(app) - login_manager.init_app(app) - migrate.init_app(app, db) - csrf.init_app(app) - - # Register blueprints - from app.routes.auth import auth_bp - from app.routes.dashboard import dashboard_bp - - app.register_blueprint(auth_bp) - app.register_blueprint(dashboard_bp) - - # Import all models so Flask-Migrate can see them - with app.app_context(): - from app.models import ( - User, Account, Category, Receipt, RecurringRule, - Transaction, Budget, Goal, GoalContribution, - Investment, InvestmentTransaction, NetWorthSnapshot, - AiInsight, FxRate - ) - - # Jinja2 template globals - app.jinja_env.globals['format_currency'] = format_currency - app.jinja_env.globals['format_percent'] = format_percent - app.jinja_env.globals['format_large_number'] = format_large_number - - # Jinja2 filters - @app.template_filter('currency') - def currency_filter(value, symbol=None): - return format_currency(value, symbol) - - @app.template_filter('percent') - def percent_filter(value): - return format_percent(value) - - return app