python
# settings.py
CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672/'
CELERY_RESULT_BACKEND = 'db+mysql://user:password@localhost/db_name'
python
# settings.py
DJANGO_CELERY_SES={
"AWS_ACCESS_KEY_ID": 'your_aws_access_key_id',
"AWS_SECRET_ACCESS_KEY": 'your_aws_secret_access_key',
}
python
# tasks.py
from django_celery_ses.tasks import send_ses_email
@task()
def send_email_task(recipient, subject, message):
send_ses_email(recipient, subject, message)
python
# views.py
from .tasks import send_email_task
def send_email_view(request):
recipient = 'test@example.com'
subject = 'Hello'
message = 'This is a test email'
send_email_task.delay(recipient, subject, message)