A simple email and push notification microservice made with Django.
- Send Emails (SMTP).
- Bulk email services like newsletter, service emails.
- Scheduled email.
- Email template dashboard to create and upload emails.
- Push notification (Firebase push notification).
- Send bulk notification to user.
- Send scheduled notifications.
- Create notification template in dashboard.
- Create entry of user subscribed to different services in the database.
- Analyse user activity on email and notification clicks to send recommendation email and notification based on user preferences.
- Implement a library to integrate this microservice to an existing project.
- Add support to custom push notification.
- Add support for email services like ZOHO to send emails.
- Git - For version control
- VS-code - Recommended
- python3.7
- poetry (optional if using docker)
- Docker (optional)
- Clone this repository.
git clone https://github.com/WeCodeWebApps/email-notification-microservice cd email-notification-microservice
- Run this command to build and start docker container.
docker-compose up
- Clone this repository.
git clone https://github.com/WeCodeWebApps/email-notification-microservice cd email-notification-microservice
- Install Poetry.
- Set Poetry config to make virtual environment inside project (Optional).
poetry config virtualenvs.in-project true
- Install the dependency.
poetry install
- Run local server.
poetry run python manage.py runserver
All the configuration like secret key, database, etc are all setup using django-environ, all these configuration are take from .env
file in the root directory.
To setup configuration, look into .env.dist
file.
While local development copy .env.dist
into .env
file with your own requirements.
NOTE: Please don't commit
.env
file into version control.
We are using Poetry as our default package manager for managing all Python dependencies.
- Add any dependency using.
poetry add <dependency name>
- If add any new dependency which is required in production update
requirements.txt
file also.poetry export --without-hashes -o requirements.txt
Important: Please insure that
requirements.txt
does not includes dev dependencies as it increase the container size of application otherwise deletepoetry.lock
and runpoetry install
to generate the newpoetry.lock
file, then follow above procedure to get it done.
- Add dependency as dev dependency if not required in production.
poetry add --dev <dev dependency name>
- Insure that you have not included any confidential file or data before pushing.
- Write the test if possible and insure all test case passes before pushing.
- Make sure your code is well formatted with
black
before pushing to avoid build error.black . # run inside base directory
To deploy on server like EC2, Google cloud, etc clone the master branch, set config variables in .env
file and run.
docker-compose -f docker-compose.prod.yaml up -d
This will start the server which can be listen on port 80.
To use custom port set environment variable
PORT=<custom_port>
in.env
file.
- Click on above button to install app on heroku.
- Fill app name and allowed hosts (Optional) and click deploy.
- You can also set other config variables like DEBUG, etc in settings.
This repository is licensed under the MIT License