DmitrMakeev's picture
Update app.py
f8101df verified
raw
history blame
1.05 kB
import flask
from flask import request, jsonify
import os
from dotenv import load_dotenv
import globs
from flask import render_template
from api_logic import api
load_dotenv()
app = flask.Flask(__name__, template_folder="./")
app.config['DEBUG'] = True
@app.route("/")
def index():
return flask.render_template('index.html')
@app.route('/page', methods=['GET'])
def page():
return render_template('zapro.html')
@app.route('/zapro', methods=['GET'])
def zapro():
# globs.initialize()
# return flask.render_template('zapro.html', ph_values=globs.ph_value, ec_values=globs.ec_value)
return jsonify(dey=globs.dey, wek=globs.wek, ph=globs.ph, ec=globs.ec, tS=globs.tS, tA=globs.tA, hDm=globs.hDm, sVen=globs.sVen)
# return render_template('zapro.html', ph_values=globs.ph_value, ec_values=globs.ec_value)
@app.route("/api", methods=['GET'])
def handle_api():
response = api()
return response
if __name__ == '__main__':
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))