|
|
@ -40,13 +40,23 @@ if IS_DEV: |
|
|
] |
|
|
] |
|
|
else: |
|
|
else: |
|
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False').lower() in ('true', '1', 't') |
|
|
DEBUG = os.getenv('DJANGO_DEBUG', 'False').lower() in ('true', '1', 't') |
|
|
ALLOWED_HOSTS = [host.strip() for host in os.getenv('ALLOWED_HOSTS', '*').split(',') if host.strip()] |
|
|
|
|
|
|
|
|
allowed_hosts_raw = os.getenv('ALLOWED_HOSTS', '*') |
|
|
|
|
|
ALLOWED_HOSTS = [host.strip() for host in allowed_hosts_raw.split(',') if host.strip()] |
|
|
|
|
|
if '*' not in ALLOWED_HOSTS: |
|
|
|
|
|
ALLOWED_HOSTS.extend(['localhost', '127.0.0.1', 'backend', 'divar_backend']) |
|
|
|
|
|
|
|
|
CORS_ALLOW_ALL_ORIGINS = os.getenv('CORS_ALLOW_ALL_ORIGINS', 'False').lower() in ('true', '1', 't') |
|
|
CORS_ALLOW_ALL_ORIGINS = os.getenv('CORS_ALLOW_ALL_ORIGINS', 'False').lower() in ('true', '1', 't') |
|
|
if not CORS_ALLOW_ALL_ORIGINS: |
|
|
if not CORS_ALLOW_ALL_ORIGINS: |
|
|
CORS_ALLOWED_ORIGINS = [origin.strip() for origin in os.getenv('CORS_ALLOWED_ORIGINS', '').split(',') if origin.strip()] |
|
|
CORS_ALLOWED_ORIGINS = [origin.strip() for origin in os.getenv('CORS_ALLOWED_ORIGINS', '').split(',') if origin.strip()] |
|
|
|
|
|
|
|
|
csrf_origins = os.getenv('CSRF_TRUSTED_ORIGINS', 'http://localhost,http://127.0.0.1') |
|
|
csrf_origins = os.getenv('CSRF_TRUSTED_ORIGINS', 'http://localhost,http://127.0.0.1') |
|
|
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in csrf_origins.split(',') if origin.strip()] |
|
|
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in csrf_origins.split(',') if origin.strip()] |
|
|
|
|
|
|
|
|
|
|
|
# Reverse Proxy SSL / Host headers configuration (for Nginx / Docker reverse proxies) |
|
|
|
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') |
|
|
|
|
|
USE_X_FORWARDED_HOST = True |
|
|
|
|
|
USE_X_FORWARDED_PORT = True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Application definition |
|
|
# Application definition |
|
|
|