Browse Source

Update settings.py

main
scayac 6 months ago
parent
commit
9fce91a1c5
  1. 9
      README.md
  2. 5
      ia_prof/settings.py

9
README.md

@ -81,11 +81,18 @@ IAProf
``` ```
DJANGO_SECRET_KEY=<votre_clé_secrète> DJANGO_SECRET_KEY=<votre_clé_secrète>
OPENAI_API_KEY=<votre_clé_openai> OPENAI_API_KEY=<votre_clé_openai>
DJANGO_DEBUG=0 DJANGO_DEBUG=True
DJANGO_ALLOWED_HOSTS=127.0.0.1,localhost 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 ## Utilisation
- Rendez-vous sur `http://127.0.0.1:8000/login` pour accéder à la page de connexion. - 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. - 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éé.

5
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', '') OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY', '')
DEBUG = os.environ.get('DJANGO_DEBUG', '') == '1' DEBUG = os.environ.get('DJANGO_DEBUG', '') == '1'
ALLOWED_HOSTS = os.environ.get('DJANGO_ALLOWED_HOSTS', '').split(',') if not DEBUG else [] 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 # Application definition
@ -108,3 +109,7 @@ STATICFILES_DIRS = [os.path.join(BASE_DIR, 'main', 'templates', 'static')] if os
# https://docs.djangoproject.com/en/4.x/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/4.x/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_SECURE = True
Loading…
Cancel
Save