This project is created to manage api for mailbox. Mailbox is created for managing asynchronous tasks by using Celery and Redis. It is build using Django 4.2.7. Project has no own GUI, is available by API.
The most important technologies used in the project:
- Python 3.12
- Django 4.2.7
- DjangoRestFramework 3.14.0
- Celery 5.3.4
- Redis 5.0.1
- PostgreSQL 16
- Docker 24.0.5
- Pre-commit 3.5.0
User can create his own mailbox and email template. Using them it's possible to email to any address with the structure of a created template.
Configure your project by setting up environment variables:
- SECRET_KEY - default is randomly generated
Create local server of PostgreSQL, and set variables to connect:
- DB_USER - database user
- DB_PASSWORD - database user password
- DB_HOST - database host
- DB_NAME - database name
- PORT - database port
For sending mail, connect to email service:
- EMAIL_HOST_USER - user of email host
- EMAIL_HOST_PASSWORD - password to email host
- DEFAULT_FROM_EMAIL - default email address to send mails
- EMAIL_HOST=smtp.sendgrid.net
- EMAIL_USE_TLS=True
- EMAIL_PORT=587
You have follow a few steps:
-
Run database migrations:
cd src python manage.py migrate
-
Run redis on Docker:
docker-compose up --build
-
Run app server:
python manage.py runserver
-
Run Celery worker
celery -A core worker -l info
Overview of the database structure and models:
-
[Model 1]: Mailbox - model for mailbox. Include all settings and login
-
[Model 2]: Template - for message. Include subject, text and attachments.
-
[Model 3]: Email - model for every message. Include Template and Mailbox as FK's.