From 9fce91a1c5bde29719d09e18c912304046b1f24d Mon Sep 17 00:00:00 2001 From: scayac Date: Mon, 16 Jun 2025 17:52:50 +0200 Subject: [PATCH] Update settings.py --- README.md | 11 +++++++++-- ia_prof/settings.py | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f840f47..c0dd61c 100644 --- a/README.md +++ b/README.md @@ -81,11 +81,18 @@ IAProf ``` DJANGO_SECRET_KEY= OPENAI_API_KEY= - DJANGO_DEBUG=0 + DJANGO_DEBUG=True DJANGO_ALLOWED_HOSTS=127.0.0.1,localhost ``` +8. (Optionnel mais recommandé) Créez un superutilisateur pour accéder à l’interface d’administration Django : + ``` + python manage.py createsuperuser + ``` + Suivez les instructions pour définir un nom d’utilisateur, une adresse e-mail et un mot de passe. + ## Utilisation - Rendez-vous sur `http://127.0.0.1:8000/login` pour accéder à la page de connexion. -- Après connexion, vous serez redirigé vers la vue de connexion. \ No newline at end of file +- Après connexion, vous serez redirigé vers la vue de connexion. +- Pour accéder à l’interface d’administration Django, allez sur `http://127.0.0.1:8000/admin` et connectez-vous avec le compte superutilisateur créé. \ No newline at end of file diff --git a/ia_prof/settings.py b/ia_prof/settings.py index 183e840..f0dae9a 100644 --- a/ia_prof/settings.py +++ b/ia_prof/settings.py @@ -13,6 +13,7 @@ SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', '') OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY', '') DEBUG = os.environ.get('DJANGO_DEBUG', '') == '1' ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', '').split(',') if not DEBUG else [] +CSRF_TRUSTED_ORIGINS = os.environ.get('DJANGO_CSRF_TRUSTED_ORIGINS', '').split(',') if not DEBUG else [] # Application definition @@ -107,4 +108,8 @@ STATICFILES_DIRS = [os.path.join(BASE_DIR, 'main', 'templates', 'static')] if os # Default primary key field type # https://docs.djangoproject.com/en/4.x/ref/settings/#default-auto-field -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' \ No newline at end of file +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') +CSRF_COOKIE_SECURE = True +SESSION_COOKIE_SECURE = True \ No newline at end of file