Files
Ske_Signage/config.py
2025-07-16 08:03:57 +03:00

66 lines
1.8 KiB
Python

"""
SKE Digital Signage Server Configuration
"""
import os
from datetime import timedelta
class Config:
"""Base configuration class"""
# Application Settings
SECRET_KEY = os.environ.get('SECRET_KEY', 'ske-signage-secret-key-change-in-production')
# Server Information
SERVER_VERSION = "2.0.0"
BUILD_DATE = "2025-07-15"
# Database Configuration
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
'sqlite:///' + os.path.join(os.path.abspath(os.path.dirname(__file__)), 'instance', 'ske_signage.db')
SQLALCHEMY_TRACK_MODIFICATIONS = False
# Upload Configuration
MAX_CONTENT_LENGTH = 2 * 1024 * 1024 * 1024 # 2GB
UPLOAD_FOLDER = 'static/uploads'
ALLOWED_EXTENSIONS = {
'images': {'png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp'},
'videos': {'mp4', 'avi', 'mov', 'wmv', 'flv', 'webm', 'mkv'},
'documents': {'pdf', 'pptx', 'ppt'}
}
# Security Configuration
SESSION_PERMANENT = False
PERMANENT_SESSION_LIFETIME = timedelta(hours=24)
# Logging Configuration
LOG_LEVEL = os.environ.get('LOG_LEVEL', 'INFO')
# Media Processing Configuration
FFMPEG_PATH = os.environ.get('FFMPEG_PATH', 'ffmpeg')
LIBREOFFICE_PATH = os.environ.get('LIBREOFFICE_PATH', 'libreoffice')
class DevelopmentConfig(Config):
"""Development configuration"""
DEBUG = True
SQLALCHEMY_ECHO = True
class ProductionConfig(Config):
"""Production configuration"""
DEBUG = False
SQLALCHEMY_ECHO = False
class TestingConfig(Config):
"""Testing configuration"""
TESTING = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
WTF_CSRF_ENABLED = False
# Configuration dictionary
config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'testing': TestingConfig,
'default': DevelopmentConfig
}