58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
"""generated with djinit"""
|
|
|
|
from .base import *
|
|
import os
|
|
import dj_database_url
|
|
|
|
DEBUG = False
|
|
SECRET_KEY = os.getenv('SECRET_KEY')
|
|
ALLOWED_HOSTS = os.getenv('ALLOWED_HOSTS', '').split(',')
|
|
|
|
# Database
|
|
# Using individual database parameters
|
|
DATABASES = {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.postgresql',
|
|
'NAME': os.getenv('DB_NAME'),
|
|
'USER': os.getenv('DB_USER'),
|
|
'PASSWORD': os.getenv('DB_PASSWORD'),
|
|
'HOST': os.getenv('DB_HOST'),
|
|
'PORT': os.getenv('DB_PORT'),
|
|
}
|
|
}
|
|
|
|
# CORS settings for production
|
|
# Filter out empty strings from FRONTEND_URL
|
|
frontend_urls = os.getenv("FRONTEND_URL", "")
|
|
CORS_ALLOWED_ORIGINS = [
|
|
origin.strip() for origin in frontend_urls.split(",") if origin.strip()
|
|
]
|
|
CORS_ALLOW_CREDENTIALS = True
|
|
|
|
# Additional CORS security for production
|
|
CORS_ALLOW_PRIVATE_NETWORK = False
|
|
|
|
# Email settings
|
|
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
|
EMAIL_HOST = os.getenv('EMAIL_HOST')
|
|
EMAIL_PORT = int(os.getenv('EMAIL_PORT', 587))
|
|
EMAIL_USE_TLS = os.getenv('EMAIL_USE_TLS', 'True').lower() == 'true'
|
|
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
|
|
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
|
|
DEFAULT_FROM_EMAIL = os.environ.get("EMAIL_HOST_USER")
|
|
SERVER_EMAIL = os.environ.get("EMAIL_HOST_USER")
|
|
|
|
# Security settings for production
|
|
SECURE_SSL_REDIRECT = True
|
|
SECURE_HSTS_SECONDS = 31536000
|
|
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
|
|
SECURE_HSTS_PRELOAD = True
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
|
|
# Session settings
|
|
SESSION_COOKIE_SECURE = True
|
|
CSRF_COOKIE_SECURE = True
|
|
|
|
# Static files
|
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|