"""
Production settings for PX360 project.
"""
from .base import *  # noqa

DEBUG = False

# Security settings for production
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 31536000  # 1 year
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True

# Allowed hosts must be set via environment variable
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS')

# Database - Must be set via environment variable
DATABASES = {
    'default': env.db('DATABASE_URL')
}

# Celery - Production settings
CELERY_TASK_ALWAYS_EAGER = False

# Logging - Production level
LOGGING['loggers']['django']['level'] = 'INFO'  # noqa
LOGGING['loggers']['apps']['level'] = 'INFO'  # noqa

# Email backend for production
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

# Static files - Ensure WhiteNoise is properly configured
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

# Admin URL should be changed in production
ADMIN_URL = env('ADMIN_URL', default='admin/')
