added sending through celery

This commit is contained in:
michail 2019-10-02 12:09:45 +05:00
parent c0149a0695
commit 02638a26fe
3 changed files with 12 additions and 14 deletions

View File

@ -14,9 +14,7 @@ class NewsTypeAdmin(admin.ModelAdmin):
def send_email_action(modeladmin, request, queryset):
news_ids = [n.id for n in queryset]
send_email_with_news(news_ids)
# send_email_with_news.delay(news_ids)
send_email_with_news.delay(news_ids)
return

View File

@ -7,7 +7,7 @@ from django.conf import settings
from smtplib import SMTPException
# @shared_task
@shared_task
def send_email_with_news(news_ids):
subscribers = Subscriber.objects.filter(state=Subscriber.USABLE)

View File

@ -12,8 +12,8 @@ services:
- POSTGRES_DB=postgres
ports:
- "5436:5432"
networks:
- db-net
# networks:
# - db-net
volumes:
- gm-db:/var/lib/postgresql/data/
elasticsearch:
@ -28,8 +28,8 @@ services:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- discovery.type=single-node
- xpack.security.enabled=false
networks:
- app-net
# networks:
# - app-net
# RabbitMQ
rabbitmq:
image: rabbitmq:latest
@ -83,18 +83,18 @@ services:
- worker
- worker_beat
- elasticsearch
networks:
- app-net
- db-net
# networks:
# - app-net
# - db-net
volumes:
- .:/code
- gm-media:/media-data
ports:
- "8000:8000"
networks:
app-net:
db-net:
#networks:
# app-net:
# db-net:
volumes:
gm-db: