forked from kdevanath/Where-Should-I-Live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.py
55 lines (41 loc) · 1.36 KB
/
server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from flask import request, Flask, jsonify, render_template, redirect, json
import utility
from qol_db import db
import clean_data
app = Flask(__name__)
qol = db.Database_QOL()
@app.route('/')
def hello():
return render_template('index.html')
@app.route('/contact')
def contact():
return render_template('contact.html')
@app.route('/about')
def about():
return render_template('about.html')
@app.route('/signUpUser', methods=['POST'])
def signUpUser():
user = request.form['username']
password = request.form['password']
return json.dumps({'status':'OK','user':user,'pass':password})
@app.route('/get_data/crime=<crime>/healthcare=<healthcare>/pollution=<pollution>/restaurant=<restaurant>', methods=['POST'])
def getMapData(crime, healthcare, pollution, restaurant):
user_in = request.form.get("Crime")
print('hello')
print("Crime: " + crime)
print("Healthcare: " + healthcare)
print("Pollution: " + pollution)
print("Restaurant: " + restaurant)
print('that was it')
filters = [crime, healthcare, pollution, restaurant]
data = utility.get_Data(filters)
return data
@app.route('/life', methods=['GET'])
def get_cities():
db_json = qol.get_data_test()
print(db_json)
return db_json
if __name__=="__main__":
clean_data.request_cost_of_living_rankings()
qol.database_test()
app.run(port = 5002)