Files
capitalism-eats-the-world/app/__init__.py

39 lines
933 B
Python

"""
Flask Application Factory
Creates and configures the Flask application with SocketIO support for real-time
updates of the Markov economics simulation.
"""
from flask import Flask
from flask_socketio import SocketIO
from config import config
# Initialize SocketIO
socketio = SocketIO(cors_allowed_origins="*")
def create_app(config_name='development'):
"""
Create and configure the Flask application.
Args:
config_name: Configuration profile to use
Returns:
Configured Flask application instance
"""
app = Flask(__name__)
app.config.from_object(config[config_name])
# Initialize extensions
socketio.init_app(app, async_mode='threading')
# Register blueprints
from .routes.main import main_bp
from .routes.api import api_bp
app.register_blueprint(main_bp)
app.register_blueprint(api_bp, url_prefix='/api')
return app