Merge branch 'develop' into 'master'
Hotfix See merge request vtmk/web2.0!86
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
from . import mqtt
|
||||
import logging
|
||||
|
||||
mqtt.client.loop_start()
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from coffee_scale import mqtt
|
||||
|
||||
|
||||
class CoffeeScaleConfig(AppConfig):
|
||||
name = 'coffee_scale'
|
||||
|
||||
def ready(self):
|
||||
if ('makemigrations' in sys.argv or 'migrate' in sys.argv):
|
||||
return
|
||||
|
||||
try:
|
||||
logging.info('Connecting to MQTT (coffee scale) at {}...'.format(mqtt.HOST))
|
||||
logging.info('If there is no confirmation, the MQTT connection has probably failed.')
|
||||
mqtt.client.connect_async(mqtt.HOST, mqtt.PORT, 60)
|
||||
mqtt.client.loop_start()
|
||||
except Exception as ex:
|
||||
logging.error(ex)
|
||||
logging.error('Failed to connect to MQTT at {}'.format(mqtt.HOST))
|
||||
|
||||
@@ -56,12 +56,3 @@ client = mqtt.Client()
|
||||
client.on_connect = on_connect
|
||||
client.on_message = on_message
|
||||
client.on_disconnect = on_disconnect
|
||||
|
||||
|
||||
try:
|
||||
logging.info('Connecting to MQTT at {}...'.format(HOST))
|
||||
logging.info('If there is no confirmation, the MQTT connection has probably failed.')
|
||||
client.connect_async(HOST, PORT, 60)
|
||||
except Exception as ex:
|
||||
logging.error(ex)
|
||||
logging.error('Failed to connect to MQTT at {}'.format(HOST))
|
||||
|
||||
@@ -16,8 +16,8 @@ class HSLFetcher:
|
||||
|
||||
last_fetched = datetime.fromtimestamp(86400) # epoch
|
||||
INTERVAL = 1 # minutes
|
||||
logging.info(
|
||||
"Set up scheduled HSL API fetch every {} minutes".format(INTERVAL))
|
||||
# logging.info(
|
||||
# "Set up scheduled HSL API fetch every {} minutes".format(INTERVAL))
|
||||
|
||||
def fetch_if_needed(self):
|
||||
"""Check if new fetch from HSL API is needed."""
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ INSTALLED_APPS = [
|
||||
'webapp',
|
||||
'members',
|
||||
'infoscreen',
|
||||
'coffee_scale',
|
||||
'coffee_scale.apps.CoffeeScaleConfig',
|
||||
'rest_framework',
|
||||
'django_nose',
|
||||
'bootstrap3',
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
/* position: absolute; */
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 60px; /* Set the fixed height of the footer here */
|
||||
line-height: 60px; /* Vertically center the text there */
|
||||
/* line-height: 60px; /* Vertically center the text there */ */
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
@@ -30,5 +30,5 @@ footer .container .col .nav .nav-item {
|
||||
}
|
||||
|
||||
footer .lang-form {
|
||||
max-width: 10rem;
|
||||
margin: 1rem auto 0;
|
||||
}
|
||||
|
||||
+29
-34
@@ -3,40 +3,35 @@
|
||||
{% load staticfiles %}
|
||||
<link rel="stylesheet" href="{% static "css/footer.css" %}">
|
||||
|
||||
<footer>
|
||||
<div class="container">
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
<form class="lang-form form" action="{% url 'set_language' %}" method="post">{% csrf_token %}
|
||||
<span>
|
||||
<input name="next" type="hidden" value="{{ redirect_to }}" />
|
||||
<select onchange="this.form.submit()" class="lang-select form-control" name="language">
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
{% get_available_languages as LANGUAGES %}
|
||||
{% get_language_info_list for LANGUAGES as languages %}
|
||||
{% for language in languages %}
|
||||
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>
|
||||
{{ language.name_local }} ({{ language.code }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
</form>
|
||||
<span>{% trans "Copyright Aalto-yliopiston Sähköinsinöörikilta ry" %} {% now 'Y' %}</span>
|
||||
</div>
|
||||
<div class="col">
|
||||
<ul class="nav">
|
||||
<li class="nav-item">
|
||||
<a href="/members"><i class="fa fa-group"></i></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/infoscreen"><i class="fa fa-info"></i></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/admin"><i class="fa fa-gears"></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<footer style="text-align: center">
|
||||
<div>
|
||||
<form class="lang-form form" action="{% url 'set_language' %}" method="post">{% csrf_token %}
|
||||
<span>
|
||||
<input name="next" type="hidden" value="{{ redirect_to }}" />
|
||||
<select onchange="this.form.submit()" class="lang-select form-control" name="language">
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
{% get_available_languages as LANGUAGES %}
|
||||
{% get_language_info_list for LANGUAGES as languages %}
|
||||
{% for language in languages %}
|
||||
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>
|
||||
{{ language.name_local }} ({{ language.code }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</span>
|
||||
</form>
|
||||
<span>{% trans "Copyright Aalto-yliopiston Sähköinsinöörikilta ry" %} {% now 'Y' %}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span class="nav-item">
|
||||
<a href="/members"><i class="fa fa-group"></i></a>
|
||||
</span>
|
||||
<span class="nav-item">
|
||||
<a href="/infoscreen"><i class="fa fa-info"></i></a>
|
||||
</span>
|
||||
<span class="nav-item">
|
||||
<a href="/admin"><i class="fa fa-gears"></i></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
|
||||
.navbar-light .navbar-nav .nav-link {
|
||||
color: #102a40;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,3 +31,7 @@
|
||||
margin-bottom: 331px;
|
||||
}
|
||||
}
|
||||
|
||||
.kaehmy-banner-image {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
{% load i18n %}
|
||||
<link rel="stylesheet" href="/static/css/sik_header.css">
|
||||
|
||||
<div class="header-content">
|
||||
<div class="kaehmy_header-content">
|
||||
<div class="kaehmy-banner logo">
|
||||
<a href="/kaehmy"><img src="/static/img/kaehmy_banner.png" alt="Aalto-yliopiston Sähköinsinöörikilta ry"></a>
|
||||
<a href="/kaehmy"><img class="kaehmy-banner-image" src="/static/img/kaehmy_banner.png" alt="Aalto-yliopiston Sähköinsinöörikilta ry"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user