diff --git a/coffee_scale/__init__.py b/coffee_scale/__init__.py index 61bc51a..e69de29 100644 --- a/coffee_scale/__init__.py +++ b/coffee_scale/__init__.py @@ -1,4 +0,0 @@ -from . import mqtt -import logging - -mqtt.client.loop_start() diff --git a/coffee_scale/apps.py b/coffee_scale/apps.py index 7785abc..57c4c5b 100644 --- a/coffee_scale/apps.py +++ b/coffee_scale/apps.py @@ -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)) diff --git a/coffee_scale/mqtt.py b/coffee_scale/mqtt.py index ee49cd7..47a4592 100644 --- a/coffee_scale/mqtt.py +++ b/coffee_scale/mqtt.py @@ -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)) diff --git a/infoscreen/hsl_fetcher.py b/infoscreen/hsl_fetcher.py index 6ad17f7..d4d00ea 100644 --- a/infoscreen/hsl_fetcher.py +++ b/infoscreen/hsl_fetcher.py @@ -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.""" diff --git a/sikweb/base.py b/sikweb/base.py index 527c645..c094344 100644 --- a/sikweb/base.py +++ b/sikweb/base.py @@ -78,7 +78,7 @@ INSTALLED_APPS = [ 'webapp', 'members', 'infoscreen', - 'coffee_scale', + 'coffee_scale.apps.CoffeeScaleConfig', 'rest_framework', 'django_nose', 'bootstrap3', diff --git a/static/css/footer.css b/static/css/footer.css index 3432e11..bf63819 100644 --- a/static/css/footer.css +++ b/static/css/footer.css @@ -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; } diff --git a/templates/footer.html b/templates/footer.html index d4eb5b2..cb749a1 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -3,40 +3,35 @@ {% load staticfiles %} - diff --git a/webapp/static/css/kaehmy_nav.css b/webapp/static/css/kaehmy_nav.css index 3db3e87..8b629d1 100644 --- a/webapp/static/css/kaehmy_nav.css +++ b/webapp/static/css/kaehmy_nav.css @@ -8,4 +8,4 @@ .navbar-light .navbar-nav .nav-link { color: #102a40; -} \ No newline at end of file +} diff --git a/webapp/static/css/sik_header.css b/webapp/static/css/sik_header.css index 1424c20..7a98d73 100644 --- a/webapp/static/css/sik_header.css +++ b/webapp/static/css/sik_header.css @@ -31,3 +31,7 @@ margin-bottom: 331px; } } + +.kaehmy-banner-image { + width: 100%; +} \ No newline at end of file diff --git a/webapp/templates/kaehmy_header.html b/webapp/templates/kaehmy_header.html index 79e3f50..f536c5a 100644 --- a/webapp/templates/kaehmy_header.html +++ b/webapp/templates/kaehmy_header.html @@ -1,8 +1,8 @@ {% load i18n %} -
+