Example #1
from flask import Flask, request, session, g, redirect, url_for, \
     abort, render_template, flash, Response, send_from_directory
import time
from bluepy import btle
import logging
import server_settings

app = Flask(__name__)
# WARNING: For some reason, setting Flask DEBUG=True causes btle to fail
app.config["PROPOGATE_EXCEPTIONS"] = True

# Log to stdout
logFormatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-5.5s]  %(message)s")
rootLogger = logging.getLogger()
consoleHandler = logging.StreamHandler()

notification_data = False # Buffer to store data from BTLE. False if nothing yet read or data already read
temperature = None # None if not yet loaded
visor_status = None

debug = True

response_prefix = """
<title>CAT COMMANDER</title>