Initial commit: Markov Economics Simulation App
This commit is contained in:
39
app/__init__.py
Normal file
39
app/__init__.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""
|
||||
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
|
Reference in New Issue
Block a user