Added crontab to celery schedule

This commit is contained in:
ayxan 2022-10-16 22:16:33 +04:00
parent 4f795b628f
commit 9294a769be
8 changed files with 42 additions and 9 deletions

View File

@ -1,5 +1,6 @@
import os import os
from celery import Celery from celery import Celery
from celery.schedules import crontab
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.development") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.development")
@ -10,6 +11,6 @@ app.autodiscover_tasks()
app.conf.beat_schedule = { app.conf.beat_schedule = {
'send-emails': { 'send-emails': {
'task': 'send_emails', 'task': 'send_emails',
'schedule': 86400, 'schedule': crontab(hour=23, minute=58),
}, },
} }

View File

@ -93,5 +93,3 @@ EMAIL_HOST_USER = 'series.notification@gmail.com'
EMAIL_PORT = 465 EMAIL_PORT = 465
EMAIL_USE_SSL = True EMAIL_USE_SSL = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
CELERY_BROKER_URL = "amqp://guest:guest@rabbitmq:5672/"

View File

@ -5,7 +5,7 @@ DEBUG = True
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
CSRF_TRUSTED_ORIGINS=['http://127.0.0.1:1337'] CSRF_TRUSTED_ORIGINS=['http://127.0.0.1:8000']
DATABASES = { DATABASES = {
'default': { 'default': {

View File

@ -23,3 +23,5 @@ STATIC_ROOT = os.path.join(os.path.dirname(os.path.dirname(BASE_DIR)), 'django_s
STATICFILES_DIRS = [ STATICFILES_DIRS = [
BASE_DIR / 'static' BASE_DIR / 'static'
] ]
CELERY_BROKER_URL = "amqp://guest:guest@rabbitmq:5672/"

View File

@ -6,6 +6,7 @@
{% block content %} {% block content %}
{% include 'components/message.html' %} {% include 'components/message.html' %}
<link rel="stylesheet" href="{% static 'css/homepage.css' %}">
<table class="table" style="margin-bottom: 1.5rem;"> <table class="table" style="margin-bottom: 1.5rem;">
<thead> <thead>
@ -24,10 +25,10 @@
</a> </a>
<br> <br>
<a class="btn mr-1 update-btn" style="padding: 0;" href="{% url 'update-series' s.slug %}"> <a class="btn mr-1 update-btn" style="padding: 0;" href="{% url 'update-series' s.slug %}">
<img src="{% static 'icons/edit.png' %}" width="21px" height="21px"> <img class="edit-icon" src="{% static 'icons/edit.png' %}" width="21px" height="21px">
</a> </a>
<a class="btn delete-btn" href="{% url 'delete-series' s.slug %}"> <a class="btn delete-btn" href="{% url 'delete-series' s.slug %}">
<img src="{% static 'icons/trash.png' %}" width="24px" height="24px"> <img class="trash-icon" src="{% static 'icons/trash.png' %}" width="24px" height="24px">
</a> </a>
</th> </th>
<td> <td>

View File

@ -4,6 +4,7 @@
{% block title %} New Episodes of The Series {% endblock title %} {% block title %} New Episodes of The Series {% endblock title %}
{% block content %} {% block content %}
<link rel="stylesheet" href="{% static 'css/new_episodes.css' %}">
<table class="table" style="margin-bottom: 1.5rem;"> <table class="table" style="margin-bottom: 1.5rem;">
<thead> <thead>

View File

@ -0,0 +1,15 @@
@media only screen and (max-width: 510px) {
table {
font-size: 90%;
}
.edit-icon {
width: 19px;
height: 19px;
}
.trash-icon {
width: 21px;
height: 21px;
}
}

View File

@ -0,0 +1,15 @@
@media only screen and (max-width: 510px) {
table {
font-size: 85%;
}
.edit-icon {
width: 15px;
height: 15px;
}
.trash-icon {
width: 17px;
height: 17px;
}
}