itsluckysharma01's picture
Clean deployment
4ed7d03
"""
Settings Configuration
Application-wide settings and configuration
"""
from pathlib import Path
# Flask Settings
FLASK_ENV = 'development'
DEBUG = True
SECRET_KEY = 'netra-surveillance-secret-key-2024'
# Paths
PROJECT_ROOT = Path(__file__).parent.parent
INSTANCE_FOLDER = PROJECT_ROOT / 'instance'
UPLOAD_FOLDER = PROJECT_ROOT / 'webapp' / 'uploads'
PROCESSED_FOLDER = UPLOAD_FOLDER / 'processed'
# Ensure all folders exist
INSTANCE_FOLDER.mkdir(parents=True, exist_ok=True)
UPLOAD_FOLDER.mkdir(parents=True, exist_ok=True)
PROCESSED_FOLDER.mkdir(parents=True, exist_ok=True)
# Database - use absolute path, properly formatted for SQLite on Windows
DB_FILE = INSTANCE_FOLDER / 'netra.db'
# Convert absolute path to URL format (3 slashes + drive letter + rest of path)
DB_URL = str(DB_FILE).replace('\\', '/')
DATABASE_URI = f'sqlite:///{DB_URL}'
SQLALCHEMY_TRACK_MODIFICATIONS = False
# File Upload
MAX_CONTENT_LENGTH = 500 * 1024 * 1024 # 500MB
# Video Processing
VIDEO_CODEC = 'mp4v'
VIDEO_FPS = 20.0
# Logging
LOG_LEVEL = 'INFO'
LOG_FILE = Path(__file__).parent.parent / 'netra.log'
# CORS Settings
CORS_ENABLED = False
# Session
PERMANENT_SESSION_LIFETIME = 3600 # 1 hour
# Model Loading
AUTO_LOAD_MODELS = True
GRACEFUL_MODEL_FALLBACK = True