""" Production settings for VorgabenUI project. """ from .base import * import os # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ.get('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', '').split(',') # Database - use PostgreSQL in production DATABASES = { 'default': { 'ENGINE': os.environ.get('DB_ENGINE', 'django.db.backends.postgresql'), 'NAME': os.environ.get('DB_NAME'), 'USER': os.environ.get('DB_USER'), 'PASSWORD': os.environ.get('DB_PASSWORD'), 'HOST': os.environ.get('DB_HOST', 'localhost'), 'PORT': os.environ.get('DB_PORT', '5432'), 'OPTIONS': { 'connect_timeout': 60, }, } } # Static files STATIC_ROOT = '/app/staticfiles/' # Security settings SECURE_SSL_REDIRECT = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') SECURE_HSTS_SECONDS = 31536000 SECURE_HSTS_INCLUDE_SUBDOMAINS = True SECURE_HSTS_PRELOAD = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True # CSRF settings CSRF_TRUSTED_ORIGINS = os.environ.get('CSRF_TRUSTED_ORIGINS', '').split(',') # Logging LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'formatters': { 'verbose': { 'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}', 'style': '{', }, }, 'handlers': { 'file': { 'class': 'logging.handlers.RotatingFileHandler', 'filename': '/app/logs/django.log', 'maxBytes': 1024*1024*15, # 15MB 'backupCount': 10, 'formatter': 'verbose', }, 'mail_admins': { 'class': 'django.utils.log.AdminEmailHandler', 'level': 'ERROR', }, }, 'root': { 'handlers': ['file'], 'level': 'INFO', }, 'loggers': { 'django': { 'handlers': ['file', 'mail_admins'], 'level': 'INFO', 'propagate': False, }, 'dokumente': { 'handlers': ['file'], 'level': 'INFO', 'propagate': False, }, }, }