From 8f0b2a5c2e6f975a92aa116df34191ba300c6ec6 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 3 Apr 2024 22:06:39 +0200 Subject: [PATCH] maj README --- README.md | 134 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 100 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 582ed1c..f2b3034 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,135 @@ -# DJANGO QUIZZ +# DJANGO QUIZ :mortar_board: -### Ce projet est une version fonctionnelle actualisée de Tom Walker (https://github.com/tomwalker/django_quiz). +> Ce projet est une version fonctionnelle actualisée de Tom Walker (https://github.com/tomwalker/django_quiz). -les prérequis sont : -- python 3.6 -- pip3 -- les librairies contenus dans le requirements.txt +Il propose la possibilité de créer des quizs de type QCM ou de type ESSAY, l'administrateur peux accéder à tous les résultats, les utilisateurs peuvent consulter leurs scores ainsi que leur statistiques. + + +L'administration est gérée par Django admin et permet de créer des utilisateurs facilement. +Pour l'utilisation d'OpenID (avec Keycloak), le login "traditionnel" est désactivé mais une fois les réglages OIDC éffectués, la création d'utilisateur s'éffectue par keycloak. Les modifications apportées concernent la librairy pour la lectures des classes codées en python2 : - Utilisation de la librairy six et utilisation de Django 2.2.9 (la 3.0 ne prends plus en charge python 2). - Modification du requirements.txt en conséquence. +- Implémentation d'OpenID connect avec Keycloak settings via mozilla oidc module (dans la branche keycloak). +## PRE REQUIS :paperclip: -## INSTALLATION +- python 3.6 au minimum (fonctionne sous 3.11) +- pip3 +- Docker et compose - git clone +## INSTALLATION LOCALE :house: - cd djangoquizz +```bash +git clone https://git.legaragenumerique.fr/GARAGENUM/django-quiz.git +cd django-quiz/quiz-app +python3 manage.py runserver +``` - python3 manage.py runserver +### CEER UN UTILISATEUR ADMIN :bust_in_silhouette: -## VISITER localhost:8000/admin et ce connecter avec les identifiants administrateur par défaut : +```bash +python manage.py makemigrations +python manage.py migrate +python manage.py createsuperuser # suivre les indications pour créer un utilisateur admin +``` - user : Greg +> Se rendre à l'adresse http://localhost:8000/admin pour se connecter - mot de passe : Juliette21 +## VIA DOCKER :whale: -## Changer l'administrateur en créant un nouveaux utilisateur avec tous les droits, puis supprimer l'utilisateur "Greg" +```bash +git clone https://git.legaragenumerique.fr/GARAGENUM/django-quiz.git +cd django-quiz +docker compose up -d +``` -## CREER SON QUIZZ ! +### CEER UN UTILISATEUR ADMIN :bust_in_silhouette: -### Creer son quizz en choisissant le type (multiplechoice) : +```bash +# pour se connecter au terminal du conteneur +docker exec -it django-quiz bash +# dans le terminal du conteneur +python manage.py makemigrations +python manage.py migrate +python manage.py createsuperuser # suivre les indications pour créer un utilisateur admin +``` -### Créer des questions : +> Se rendre à l'adresse http://localhost:8000/admin pour se connecter -### Créer des utilisateurs : +## PRE REQUIS :paperclip: -### Customiser le logo : +- python 3.6 au minimum (fonctionne sous 3.11) +- pip3 +- Docker et compose -## Avec Docker : +## CONFIGURATION -### INSTALLATION +- testenv_django_quiz/settings.py: - git clone +```python +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'put-a-good-secret-key!' - cd djangoquizz +# security token +CSRF_TRUSTED_ORIGINS = ['https://quiz.your-domain/tld'] +``` - docker build -t djangoquizz . +## INSTALLATION LOCALE :house: - docker run -d -p 8000:8000 djangoquizz +```bash +git clone https://git.legaragenumerique.fr/GARAGENUM/django-quiz/src/branch/keycloak.git +cd django-quiz/quiz-app +python3 -m pip install -r requirements.txt +python3 manage.py runserver +``` -### VISITER 0.0.0.0:8000/admin +### CEER UN UTILISATEUR ADMIN :bust_in_silhouette: - admin : Greg / mdp: Juliette21 +```bash +python manage.py makemigrations +python manage.py migrate +python manage.py createsuperuser # suivre les indications pour créer un utilisateur admin +``` - --> Pour modifier les acréditations de l'admin, éffectuer : +> Se rendre à l'adresse http://localhost:8000/admin pour se connecter - python manage.py makemigrations +## VIA DOCKER :whale: - python manage.py migrate +```bash +git clone https://git.legaragenumerique.fr/GARAGENUM/django-quiz/src/branch/keycloak.git +cd django-quiz +docker compose up -d +``` - python manage.py createsuperuser +### CEER UN UTILISATEUR ADMIN :bust_in_silhouette: -### Personnaliser : +```bash +# pour se connecter au terminal du conteneur +docker exec -it django-quiz bash +# dans le terminal du conteneur +python manage.py makemigrations +python manage.py migrate +python manage.py createsuperuser # suivre les indications pour créer un utilisateur admin +``` -- Modifier la dernière ligne pour spécifier une IP (ex: 192.168.1.1:8000) -- --> répercuter l'adresse dans /testenv_django_quiz/settings.py dans ALLOWED_HOSTS = ['192.168.1.1'] +> Se rendre à l'adresse http://localhost:8000/admin pour se connecter +## TODO :bookmark_tabs: + +- [x] Modify user creation and update methods +- [x] Docker-compose.yml +- [x] OpenID with keycloak +- [ ] Secure secrets in env + ports +- [ ] Pass groups with user creation from Keycloak +- [ ] Automatiser creation superuser at startup + +## VERSION AUTHENTIFICATION EXTERNE (SSO KEYCLOAK) :key: + +> https://git.legaragenumerique.fr/GARAGENUM/django-quiz/src/branch/keycloak + +## TODO :bookmark_tabs: + +- [ ] filtre Quiz par catégories +- [ ] filtre questions par quizs