Cette application est un microservice en charge de l'envois des notification (emails, sms, push notifications).
- Python 3.8+
- Celery 5+
- Redis
- Django rest framework
- Clonage du projet en local
git clone git@gitlab.com:cryptoechangeur/microservices/notification-service.git
.
- Installation des dépendances
cd notification_service
pip install -r requirements.txt
- Configuration des variables d'environement
Créer un fichier.env
à la racine du projet et ajouter le SECRET_KEY, le CELERY_BROKER_REDIS_URL.
-
Le SECRET_KEY correspond à la clé secrete de l'application django. généré par la commande:
python -c "import secrets; print(secrets.token_urlsafe())"
. -
Le CELERY_BROKER_REDIS_URL correspond à l'URL de Redis server installé au préalable sur la machine.
Exemple de fichier .env :
DEBUG=True
SECRET_KEY = 'bfQspVSh90eG3yrQo8lBZjKLfkDCsjwXvA9Gmc12cUo'
CELERY_BROKER_REDIS_URL='redis://127.0.0.1:6379'
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
celery -A notification_service worker -l INFO -P eventlet
http://localhost:8000/apis/v1/notifications/email/singup/
http://localhost:8000/apis/v1/notifications/email/singnin/
http://localhost:8000/apis/v1/notifications/email/password-reset/request/
Tous est ready!