Browse Source

Add celery services

devel
Dmitry Novikov 7 years ago
parent
commit
e4246f073b
  1. 26
      abonapp/templates/abonapp/peoples.html
  2. 4
      abonapp/views.py
  3. 6
      systemd_units/djing.service
  4. 14
      systemd_units/djing_celery.service
  5. 2
      systemd_units/djing_dial.service
  6. 4
      systemd_units/djing_telebot.service

26
abonapp/templates/abonapp/peoples.html

@ -75,23 +75,25 @@
{% else %}
<tr class="danger">
{% endif %}
<td>{% if human.statcache.is_online %}
<span class="glyphicon glyphicon-ok text-success"></span>
{% else %}
<span class="glyphicon glyphicon-remove-sign text-muted"></span>
{% endif %}
<td>
<span class="glyphicon glyphicon-question-sign text-muted"></span>
{# {% if human.statcache.is_online %}#}
{# <span class="glyphicon glyphicon-ok text-success"></span>#}
{# {% else %}#}
{# <span class="glyphicon glyphicon-remove-sign text-muted"></span>#}
{# {% endif %}#}
</td>
<td class="col-xs-1">
<a href="{% url 'abonapp:abon_home' human.group_id human.username %}">{{ human.username }}</a>
</td>
<td class="hidden-xs">
{% if human.statcache %}
{% if human.statcache.is_today %}
{{ human.statcache.last_time|date:"H:i" }}
{% else %}
{{ human.statcache.last_time|date:"D H:i" }}
{% endif %}
{% endif %}
{# {% if human.statcache %}#}
{# {% if human.statcache.is_today %}#}
{# {{ human.statcache.last_time|date:"H:i" }}#}
{# {% else %}#}
{# {{ human.statcache.last_time|date:"D H:i" }}#}
{# {% endif %}#}
{# {% endif %}#}
</td>
<td class="col-xs-1">{{ human.ip_address|default_if_none:'&mdash;' }}</td>
<td class="col-xs-2">{{ human.fio|default:'&mdash;' }}</td>

4
abonapp/views.py

@ -51,9 +51,9 @@ class PeoplesListView(LoginRequiredMixin, OnlyAdminsMixin,
if street_id > 0:
peoples_list = peoples_list.filter(street=street_id)
peoples_list = peoples_list.select_related(
'group', 'street', 'statcache', 'current_tariff'
'group', 'street', 'current_tariff'
).only(
'group', 'street', 'statcache', 'fio',
'group', 'street', 'fio',
'street', 'house', 'telephone', 'ballance', 'markers',
'username', 'is_active', 'current_tariff'
)

6
systemd_units/djing.service

@ -4,9 +4,9 @@ Description=A job for djing
[Service]
Type=simple
ExecStart=/usr/bin/python3 periodic.py
WorkingDirectory=/srv/http/djing
User=http
Group=http
WorkingDirectory=/var/www/djing
User=www-data
Group=www-data
[Install]
WantedBy=multi-user.target

14
systemd_units/djing_celery.service

@ -0,0 +1,14 @@
[Unit]
Description=Celery worker for djing
[Service]
Type=simple
ExecStart=/var/www/djing/venv/bin/celery worker -A djing --loglevel=info --concurrency=4
WorkingDirectory=/var/www/djing
TimeoutSec=7
Restart=always
User=www-data
Group=www-data
[Install]
WantedBy=multi-user.target

2
systemd_units/djing_dial.service

@ -5,7 +5,7 @@ Description=Dialing inbox sms unit
Type=simple
ExecStart=/usr/bin/python3 dialing.py
PIDFile=/run/dialing.py.pid
WorkingDirectory=/srv/http/djing
WorkingDirectory=/var/www/djing
User=http
Group=http

4
systemd_units/djing_telebot.service

@ -8,8 +8,8 @@ PIDFile=/run/djing_telebot.pid
WorkingDirectory=/var/www/djing
TimeoutSec=9
Restart=always
User=http
Group=http
User=www-data
Group=www-data
[Install]
WantedBy=multi-user.target
Loading…
Cancel
Save