This commit is contained in:
Louis Mazin 2026-10-14 16:01:50 +02:00
parent d6fe1dbb50
commit 9ed880b125

View File

@ -26,9 +26,11 @@ SECRET_KEY = config('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config('DEBUG', default=False, cast=bool) DEBUG = config('DEBUG', default=False, cast=bool)
ALLOWED_HOSTS = [host.strip() for host in config('ALLOWED_HOSTS', default='localhost,127.0.0.1').split(',') if host.strip()] def csv_env(name, default=''):
if 'backend' not in ALLOWED_HOSTS: """Lit une liste séparée par des virgules en ignorant les valeurs vides."""
ALLOWED_HOSTS.append('backend') # Service Docker utilisé par le proxy Vite. return [value.strip() for value in config(name, default=default).split(',') if value.strip()]
ALLOWED_HOSTS = csv_env('ALLOWED_HOSTS', 'localhost,127.0.0.1,backend')
# Application definition # Application definition
@ -127,13 +129,9 @@ USE_TZ = True
STATIC_URL = 'static/' STATIC_URL = 'static/'
# CORS configuration # CORS configuration
CORS_ALLOWED_ORIGINS = [ CORS_ALLOWED_ORIGINS = csv_env('CORS_ALLOWED_ORIGINS')
"http://localhost:1028", CORS_ALLOW_ALL_ORIGINS = config('CORS_ALLOW_ALL_ORIGINS', default=False, cast=bool)
"http://127.0.0.1:1028", CSRF_TRUSTED_ORIGINS = csv_env('CSRF_TRUSTED_ORIGINS')
"http://192.168.1.19:1028",
'https://www.coursbiologiechaillou.fr',
'https://coursbiologiechaillou.fr',
]
# REST Framework & JWT settings # REST Framework & JWT settings
REST_FRAMEWORK = { REST_FRAMEWORK = {