import flask from flask import request, jsonify, send_file import os import asyncio import aiohttp from dotenv import load_dotenv import globs from flask import render_template from api_logic import api from google_db import save_db from my_sqlite import create_SQL load_dotenv() globs.dey = 0 globs.wek = 0 globs.v_hid = 0 globs.v_min = 0 globs.ph = 0 globs.ec = 0 globs.tS = 0 globs.tA = 0 globs.hDm = 0 globs.sVen = 0 globs.rFul = 0 globs.rLi = 0 globs.rWat = 0 globs.rRas = 0 globs.rPH = 0 globs.rEC = 0 globs.rSl = 0 globs.rLe = 0 globs.alW = 0 globs.ph_eep = 0 globs.ph_on_eep = 0 globs.ec_eep = 0 globs.ec_A_eep = 0 globs.ec_B_eep = 0 globs.ec_C_eep = 0 globs.l_ON_h_eep = 0 globs.l_ON_m_eep = 0 globs.l_OFF_h_eep = 0 globs.l_OFF_m_eep = 0 globs.t_Voz_eep = 0 app = flask.Flask(__name__, template_folder="./") app.config['DEBUG'] = True @app.route("/") def index(): return flask.render_template('index.html') @app.route('/online', methods=['GET']) def online(): return render_template('online.html') @app.route('/settings', methods=['GET']) def settings(): return render_template('settings.html') @app.route("/api", methods=['GET']) def handle_api(): response = api() return response @app.route("/save_db", methods=['GET']) def handle_save_db(): response = save_db() return response @app.route('/set_res') def set_res(): globs.eep_set = 0 return jsonify(value_set="reset") if __name__ == '__main__': app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))