From dc82675d8753371d9640b95dd078e71c21b5f902 Mon Sep 17 00:00:00 2001 From: Adnan Memic Date: Sat, 14 Mar 2020 17:20:07 +0000 Subject: [PATCH] visual fix --- location_app/app/__init__.py | 16 +++++++++++----- location_app/app/templates/main/index.html | 4 ++-- location_app/location_app.py | 4 +++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/location_app/app/__init__.py b/location_app/app/__init__.py index d3fc97f..b7c67fc 100644 --- a/location_app/app/__init__.py +++ b/location_app/app/__init__.py @@ -2,12 +2,18 @@ from flask import Flask from app import mqtt, routes -app = Flask(__name__) -app.config.from_envvar('MYAPP_SETTINGS') +def make_app(): + """ + Makes the app object with the configuration from + an environment variable and connects routes and mqtt + to the app + """ + app = Flask(__name__) + app.config.from_envvar('MYAPP_SETTINGS') -mqtt.init_app(app) - -routes.init_app(app) + mqtt.init_app(app) + routes.init_app(app) + return app diff --git a/location_app/app/templates/main/index.html b/location_app/app/templates/main/index.html index 9bc864d..55d925e 100644 --- a/location_app/app/templates/main/index.html +++ b/location_app/app/templates/main/index.html @@ -29,7 +29,7 @@ {% block body %}
{% if advanced %} - Your Locations + Your Locations @@ -53,7 +53,7 @@ {% endfor %}
ID
{% else %} - Your Locations + Your Locations diff --git a/location_app/location_app.py b/location_app/location_app.py index e524e69..0775eee 100644 --- a/location_app/location_app.py +++ b/location_app/location_app.py @@ -1 +1,3 @@ -from app import app \ No newline at end of file +from app import make_app + +app = make_app() \ No newline at end of file
ID