ball-tracking-cv/app/config.py
2025-08-10 10:01:43 +08:00

26 lines
696 B
Python

import os
from datetime import timedelta
class Config:
BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
# Where session folders and generated images live
DATA_DIR = os.path.join(BASE_DIR, "data")
SESSIONS_DIR = os.path.join(DATA_DIR, "sessions")
# Ensure directories exist at import time
os.makedirs(SESSIONS_DIR, exist_ok=True)
# Security & limits
MAX_CONTENT_LENGTH = 25 * 1024 * 1024 # 25 MB upload cap
# Cross-origin
CORS_ORIGINS = "*" # tighten in prod
# Housekeeping
SESSION_TTL = timedelta(hours=6) # delete session dirs older than this
# Flask
JSON_SORT_KEYS = False
PROPAGATE_EXCEPTIONS = False