UPDATE: Configurable modo monitor y tema
This commit is contained in:
@@ -7,8 +7,20 @@ load_dotenv()
|
||||
|
||||
ip = os.getenv("IPSERVER")
|
||||
puerto = os.getenv("PORT")
|
||||
modo = os.getenv("mode", "1")
|
||||
monitor1 = os.getenv("MONITOR_ID_1")
|
||||
monitor2 = os.getenv("MONITOR_ID_2")
|
||||
tema = os.getenv("THEME", "csm")
|
||||
tema_styles = {
|
||||
"csm": {
|
||||
"bg1":"#114b94",
|
||||
"bg2":"#0a6eb2"
|
||||
},
|
||||
"imq": {
|
||||
"bg1":"#CC0C00",
|
||||
"bg2":"#e6392d"
|
||||
}
|
||||
}
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -33,7 +45,11 @@ def obtener_pie(mon_id1, mon_id2):
|
||||
return []
|
||||
try:
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("SELECT MENSAJE FROM CSMK_MONITOR_PIE WHERE MONITOR_ID IN (:monitor, :monitor2) AND INACTIVO = 0 ORDER BY MONITOR_ID, MONITOR_PIE_ID ASC",{'monitor':mon_id1, 'monitor2':mon_id2})
|
||||
if modo == "2":
|
||||
cursor.execute("SELECT MENSAJE FROM CSMK_MONITOR_PIE WHERE MONITOR_ID IN (:monitor, :monitor2) AND INACTIVO = 0 ORDER BY MONITOR_ID, MONITOR_PIE_ID ASC",{'monitor':mon_id1, 'monitor2':mon_id2})
|
||||
else:
|
||||
cursor.execute("SELECT MENSAJE FROM CSMK_MONITOR_PIE WHERE MONITOR_ID IN (:monitor) AND INACTIVO = 0 ORDER BY MONITOR_ID, MONITOR_PIE_ID ASC",{'monitor':mon_id1})
|
||||
|
||||
mensajes = [fila[0] for fila in cursor.fetchall()]
|
||||
mensaje_final = " ".join(mensajes)
|
||||
cursor.close()
|
||||
@@ -45,7 +61,8 @@ def obtener_pie(mon_id1, mon_id2):
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template("index.html")
|
||||
tema_colores = tema_styles.get(tema, tema_styles["csm"])
|
||||
return render_template("index.html", mode=modo, theme=tema, theme_colors=tema_colores)
|
||||
|
||||
@app.route('/api/datos1')
|
||||
def api_datos1():
|
||||
|
||||
Reference in New Issue
Block a user