university-final-iot-backend/app/__init__.py

24 lines
449 B
Python

import atexit
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from app.mod_devices import setup_mqtt, tear_down_mqtt
app = Flask(__name__, instance_relative_config=True)
app.config.from_object('config')
app.config.from_pyfile('config.py')
db = SQLAlchemy(app)
def on_stop():
print('Application stopping')
tear_down_mqtt()
setup_mqtt(app)
atexit.register(on_stop)
@app.route("/")
def hello():
return "Hello World!"