Refactor codebase

This commit is contained in:
Peter Stockings
2026-02-24 21:23:14 +11:00
parent f3abb4781b
commit 56168a182b
11 changed files with 191 additions and 127 deletions

View File

@@ -1,10 +1,7 @@
from datetime import datetime, timezone, timedelta
from flask import Flask
from app.config import Config
from app.config import Config, SYDNEY_TZ
from app.db import init_db, close_db
SYDNEY_TZ = timezone(timedelta(hours=11))
def create_app():
app = Flask(__name__)
@@ -17,12 +14,17 @@ def create_app():
# Jinja2 filter: convert UTC to Sydney time
@app.template_filter('sydney')
def sydney_time_filter(dt, fmt='%d %b %Y, %H:%M'):
from datetime import timezone
if dt is None:
return ''
if dt.tzinfo is None:
dt = dt.replace(tzinfo=timezone.utc)
return dt.astimezone(SYDNEY_TZ).strftime(fmt)
# Make milestone labels available to all templates
from app.utils import MILESTONE_LABELS
app.jinja_env.globals['MILESTONE_LABELS'] = MILESTONE_LABELS
# Register blueprints
from app.routes.auth import bp as auth_bp
from app.routes.dashboard import bp as dashboard_bp