43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
"""
|
|
Flask Web Application for HM Video QC Tool
|
|
|
|
Provides web interface for video quality control with:
|
|
- Multi-page wizard workflow (Upload → Configure → Results)
|
|
- Real-time progress updates via Server-Sent Events
|
|
- Custom black/yellow H&M styling
|
|
- Microsoft Azure AD authentication
|
|
"""
|
|
|
|
from flask import Flask
|
|
import secrets
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
# Load environment variables from .env file
|
|
load_dotenv()
|
|
|
|
# Initialize Flask app
|
|
app = Flask(__name__)
|
|
|
|
# Security configuration
|
|
app.secret_key = secrets.token_hex(32) # Generate secure secret key for sessions
|
|
|
|
# Upload configuration
|
|
app.config['MAX_CONTENT_LENGTH'] = 5 * 1024 * 1024 * 1024 # 5GB max file size
|
|
app.config['UPLOAD_FOLDER'] = os.path.join(os.path.dirname(__file__), 'uploads')
|
|
app.config['ALLOWED_EXTENSIONS'] = {'.mp4', '.mov', '.avi', '.mkv', '.webm', '.flv', '.wmv', '.m4v'}
|
|
|
|
# Ensure upload directory exists
|
|
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
|
|
|
|
# Initialize authentication middleware
|
|
from web.auth_middleware import AuthMiddleware
|
|
auth = AuthMiddleware(
|
|
tenant_id=os.getenv('AZURE_TENANT_ID'),
|
|
client_id=os.getenv('AZURE_CLIENT_ID')
|
|
)
|
|
auth.init_app(app)
|
|
|
|
# Import and register routes (pass auth to routes)
|
|
from web.routes import register_routes
|
|
register_routes(app, auth)
|