From 02fb6066c2b9e5e28224b8f3fc224982403e7f44 Mon Sep 17 00:00:00 2001 From: Priyansh Date: Thu, 9 Dec 2021 01:40:53 -0500 Subject: Code changes due to new project structure --- app.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/app.py b/app.py index 431bd66..f17fd5c 100644 --- a/app.py +++ b/app.py @@ -1,22 +1,16 @@ from flask import Flask, render_template from flask import request import pandas as pd -from sql_functions import run_sql_pandas, get_list_of_dict -from time_series_model import plot_data +import json app = Flask(__name__) -def get_cities_list(): - sql_statement = 'SELECT DISTINCT(City_Name) as City_Name, Lat, Long FROM City_table join Loc_Table on City_Table.City_Id = Loc_table.City_Id' - return run_sql_pandas(sql_statement) - @app.route("/") @app.route("/index") def index(): - cities_list = get_cities_list() - keys = ("city", "latitude", "longitude") - cities_list = get_list_of_dict(keys, cities_list) - return render_template("index.html", cities_list=cities_list) + with open("cities.json", "r") as cities_list: + data = json.load(cities_list) + return render_template("index.html", cities_list=data) @app.route("/receiveDates", methods=["POST"]) @@ -27,7 +21,6 @@ def receive_dates(): dates = [] for i in dates_unmf: dates.append(i.strftime('%Y-%m-%d')) - plot_data(dates) return 'OK' if __name__ == '__main__': -- cgit v1.2.3