added sending through celery
This commit is contained in:
parent
c0149a0695
commit
02638a26fe
|
|
@ -14,9 +14,7 @@ class NewsTypeAdmin(admin.ModelAdmin):
|
||||||
def send_email_action(modeladmin, request, queryset):
|
def send_email_action(modeladmin, request, queryset):
|
||||||
news_ids = [n.id for n in 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
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from django.conf import settings
|
||||||
from smtplib import SMTPException
|
from smtplib import SMTPException
|
||||||
|
|
||||||
|
|
||||||
# @shared_task
|
@shared_task
|
||||||
def send_email_with_news(news_ids):
|
def send_email_with_news(news_ids):
|
||||||
|
|
||||||
subscribers = Subscriber.objects.filter(state=Subscriber.USABLE)
|
subscribers = Subscriber.objects.filter(state=Subscriber.USABLE)
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ services:
|
||||||
- POSTGRES_DB=postgres
|
- POSTGRES_DB=postgres
|
||||||
ports:
|
ports:
|
||||||
- "5436:5432"
|
- "5436:5432"
|
||||||
networks:
|
# networks:
|
||||||
- db-net
|
# - db-net
|
||||||
volumes:
|
volumes:
|
||||||
- gm-db:/var/lib/postgresql/data/
|
- gm-db:/var/lib/postgresql/data/
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
|
|
@ -28,8 +28,8 @@ services:
|
||||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||||
- discovery.type=single-node
|
- discovery.type=single-node
|
||||||
- xpack.security.enabled=false
|
- xpack.security.enabled=false
|
||||||
networks:
|
# networks:
|
||||||
- app-net
|
# - app-net
|
||||||
# RabbitMQ
|
# RabbitMQ
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
image: rabbitmq:latest
|
image: rabbitmq:latest
|
||||||
|
|
@ -83,18 +83,18 @@ services:
|
||||||
- worker
|
- worker
|
||||||
- worker_beat
|
- worker_beat
|
||||||
- elasticsearch
|
- elasticsearch
|
||||||
networks:
|
# networks:
|
||||||
- app-net
|
# - app-net
|
||||||
- db-net
|
# - db-net
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
- gm-media:/media-data
|
- gm-media:/media-data
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
|
|
||||||
networks:
|
#networks:
|
||||||
app-net:
|
# app-net:
|
||||||
db-net:
|
# db-net:
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
gm-db:
|
gm-db:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user