Mail App with Django, Django Rest Framework, Celery, Redis and Docker
- A client can create a custom mail with Mail Form.
- Each mail contains; to field, subject, body, cc and attachments.
- Client can also schedule a mail that is set as default. (New features to be add)
- Get the code
Clone the repository
git clone https://github.com/vuralmert/asynchronous-mail-celery.git
- Install the project dependencies
Enter the following command
pip install -r requirements.txt
- Run the commands to generate the database
Enter the following commands
python manage.py makemigrations
python manage.py migrate
Once you have complete dowloading requirements and migrating and none of the services failed after you have run the following command,
python manage.py runserver
- Access and Interact with API Front-end App (Django Rest Framework)
- Access Django Admin
- Create the admin user
- Logging to admin interface
- Scheduling Mails with Celery
- To use this feature first you need to install Redis from https://redis.io/download/ and then config your Redis files. Once Redis server is installed, open the terminal and run the following command to start the server.
redis-server
- Before running any commands or connecting any clients to the Redis server, you must ensure that Redis is running.
redis-cli ping
ReturnsPONG
if the server is up and running. - After making sure that Redis is installed and working properly enter the custom command that I created for ease of use of the codes we will use for Celery and Flower.
python manage.py run_and_schedule
The API Front-end application should be running and you can see it via your web browser at http://127.0.0.1:8000/mail_form which will take you to the main web app interface where you can create and send your mails.
You can check your previous mails and use query parameters to filter, order or search them via your web browser at http://127.0.0.1:8000/send_mail which will take you to the Django Rest Framework interface where you can do these operations.
For the developers I created a Swagger UI which you can access it via your web browser at http://127.0.0.1:8000/docs which will take you to the page that you can see all of your apis and schemas.
To access the admin interface first you gonna need to generate a super-user with the following command
python manage.py createsuperuserYou will be prompted to add a
username
and password
for your user.Once you have complete creating the super-user you can visit http://127.0.0.1:8000/admin which will take you to the admin interface login screen. You should enter the username
and password
created in the previous step.
The API Back-end application and tasks should be running and your scheduled mails will be sent to the active users you have created from the admin interface. You can check running and previous tasks via your web browser at http://127.0.0.6:5555 which will take you to the Flower interface.
GET /send_mail
POST /send_mail
POST /mail_form
GET /sent_mails
GET /schedule_mail
- Python
- Django
- Django Rest Framework
- Celery
- Redis
- Flower
- Docker