import os class Config: """Configuration settings for Attendr Smart Attendance System""" # Flask settings SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key-change-in-production' # Session settings for proxy (Hugging Face) SESSION_COOKIE_SECURE = True SESSION_COOKIE_SAMESITE = 'None' SESSION_COOKIE_HTTPONLY = True PERMANENT_SESSION_LIFETIME = 3600 # 1 hour # Database settings BASE_DIR = os.path.abspath(os.path.dirname(__file__)) SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \ 'sqlite:///' + os.path.join(BASE_DIR, 'attendr.db') SQLALCHEMY_TRACK_MODIFICATIONS = False # Upload folder settings UPLOAD_FOLDER = os.path.join(BASE_DIR, 'uploads') FACE_ENCODINGS_FOLDER = os.path.join(UPLOAD_FOLDER, 'face_encodings') MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB max file size # Face recognition settings FACE_RECOGNITION_TOLERANCE = 0.6 # Lower = more strict (0.6 is default) FACE_DETECTION_MODEL = 'hog' # 'hog' is faster, 'cnn' is more accurate # Geolocation settings GEOLOCATION_RADIUS_METERS = 2000 # Increased to 2000m as requested for testing # Attendance Code Settings CODE_LENGTH = 6 # Length of attendance code CODE_REFRESH_INTERVAL = 10 # Code refresh interval in seconds (10 seconds for demo) # Session Settings SESSION_DURATION_HOURS = 3 # Default session duration @staticmethod def init_app(app): """Initialize application with config""" # Create upload folders if they don't exist os.makedirs(Config.UPLOAD_FOLDER, exist_ok=True) os.makedirs(Config.FACE_ENCODINGS_FOLDER, exist_ok=True)