fix logging
All checks were successful
Build Docker Image / build (push) Successful in 13m47s

This commit is contained in:
2025-02-15 00:35:41 -08:00
parent b7e89d9c22
commit b7aa64935f
8 changed files with 59 additions and 47 deletions

View File

@@ -1,16 +1,30 @@
"""init module for the Flask application."""
import logging
from flask import Flask
from app.config import Config
from app.database import engine
from app.migrations import run_migrations
from app.models import Base
from app.views import bp
from app.migrations import run_migrations
def create_app(test_config=None):
def create_app():
"""Create and configure an instance of the Flask application."""
app = Flask(__name__, instance_relative_config=True)
app.config.from_object(Config)
# Set up Flask logger
if not app.logger.handlers:
handler = logging.StreamHandler()
handler.setFormatter(
logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
)
app.logger.addHandler(handler)
app.logger.setLevel(logging.DEBUG)
# Create database tables if they don't exist
Base.metadata.create_all(engine)
@@ -21,4 +35,6 @@ def create_app(test_config=None):
with app.app_context():
run_migrations(app)
app.logger.info("Application initialized successfully")
return app