123456789101112131415161718192021222324 |
- from app import create_app
- app, db, mqtt = create_app()
- @mqtt.on_connect()
- def handle_connect(client, userdata, flags, rc):
- mqtt.subscribe('AISKY/AppleFarm/MK-G/b8:27:eb:b7:52:9c/Log')
- @mqtt.on_log()
- def handle_logging(client, userdata, level, buf):
- print(level, buf)
- @app.teardown_appcontext
- def shutdown_session(exception=None):
- db.session.remove()
- if __name__ == '__main__':
- app.run(debug=False, threaded=True, host='0.0.0.0', port=5000)
|