-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.py
36 lines (28 loc) · 833 Bytes
/
start.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
from flask import Flask, request, render_template
from recommendation import return_neighbors
from redis import Redis
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/home')
def home():
redis.rpush("key_local", "hitted")
print("here")
print("redis is ",redis.lrange("key_local",0,-1))
return render_template('index.html')
@app.route('/admin')
def admin():
return render_template('index.html')
@app.route('/user', methods=['POST', 'GET'])
def user():
if request.method == 'POST':
query = request.form['search']
lis = return_neighbors(query)
if lis.empty:
s = "Something is fishy!! The user Id doesn't exist."
return s
else:
return lis.to_html()
else:
return render_template('index.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80)