diff options
| author | Priyansh <[email protected]> | 2021-11-17 15:26:06 -0500 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2021-11-17 15:26:06 -0500 |
| commit | 7170e823a8a9123736b112b03e929b168f79d194 (patch) | |
| tree | 3538af61bd87d8e0d8a5ccbfe864e828b7f1f9e4 /app.py | |
| parent | a74cdf64c155303c351d766a41b8a803979ce16a (diff) | |
| download | temp_pred_arima-7170e823a8a9123736b112b03e929b168f79d194.tar.xz temp_pred_arima-7170e823a8a9123736b112b03e929b168f79d194.zip | |
Heroku has no Support for SQLite: Reverting
Diffstat (limited to 'app.py')
| -rw-r--r-- | app.py | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +from flask import Flask, render_template +from flask import Markup +import sqlite3 as sql +import pandas as pd + +app = Flask(__name__) + + +def execute_sql_statement(sql_statement, conn): + cur = conn.cursor() + cur.execute(sql_statement) + rows = cur.fetchall() + return rows + +def get_list_of_dict(keys, list_of_tuples): + list_of_dict = [dict(zip(keys, values)) for values in list_of_tuples] + return list_of_dict + +def get_cities_list(): + conn = sql.connect("database.db") + 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' + df=pd.read_sql_query(sql_statement, conn).to_records(index=False) + return df + [email protected]("/") [email protected]("/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) + +if __name__ == '__main__': + app.run(debug=True) |
