65 lines
1.6 KiB
Python
65 lines
1.6 KiB
Python
"""
|
|
PunimTag Configuration Settings
|
|
|
|
Centralized configuration for the PunimTag application.
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# Base directory (project root)
|
|
BASE_DIR = Path(__file__).parent.parent
|
|
|
|
# Data directory
|
|
DATA_DIR = BASE_DIR / "data"
|
|
PHOTOS_DIR = BASE_DIR / "photos"
|
|
|
|
# Database paths
|
|
DATABASE_PATH = DATA_DIR / "punimtag_simple.db"
|
|
TEST_DATABASE_PATH = DATA_DIR / "test_backend.db"
|
|
|
|
# Ensure directories exist
|
|
DATA_DIR.mkdir(exist_ok=True)
|
|
PHOTOS_DIR.mkdir(exist_ok=True)
|
|
|
|
# Flask configuration
|
|
class Config:
|
|
"""Base configuration class."""
|
|
SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key-change-in-production'
|
|
DATABASE_PATH = str(DATABASE_PATH)
|
|
PHOTOS_DIR = str(PHOTOS_DIR)
|
|
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB max file size
|
|
UPLOAD_EXTENSIONS = {'.jpg', '.jpeg', '.png', '.gif', '.bmp'}
|
|
|
|
# Face recognition settings
|
|
FACE_DETECTION_CONFIDENCE = 0.6
|
|
FACE_SIMILARITY_THRESHOLD = 0.6
|
|
MAX_FACES_PER_IMAGE = 10
|
|
|
|
# Thumbnail settings
|
|
THUMBNAIL_SIZE = (200, 200)
|
|
FACE_THUMBNAIL_SIZE = (120, 120)
|
|
|
|
class DevelopmentConfig(Config):
|
|
"""Development configuration."""
|
|
DEBUG = True
|
|
TESTING = False
|
|
|
|
class ProductionConfig(Config):
|
|
"""Production configuration."""
|
|
DEBUG = False
|
|
TESTING = False
|
|
|
|
class TestingConfig(Config):
|
|
"""Testing configuration."""
|
|
DEBUG = True
|
|
TESTING = True
|
|
DATABASE_PATH = str(TEST_DATABASE_PATH)
|
|
|
|
# Configuration mapping
|
|
config = {
|
|
'development': DevelopmentConfig,
|
|
'production': ProductionConfig,
|
|
'testing': TestingConfig,
|
|
'default': DevelopmentConfig
|
|
} |