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

DEBUG = False

# Caddy handles SSL termination, so trust the X-Forwarded-Proto header
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SECURE_SSL_REDIRECT = env.bool('SECURE_SSL_REDIRECT', default=False)
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 = env.list('ALLOWED_HOSTS', default=[]) + ['localhost', '127.0.0.1']

DATABASES = {
    'default': env.db('DATABASE_URL')
}

CELERY_TASK_ALWAYS_EAGER = False

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

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'

STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

ADMIN_URL = env('ADMIN_URL', default='admin/')
