-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
29 lines (24 loc) · 780 Bytes
/
app.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
from flask import Flask,request,render_template,url_for
import model
app = Flask(__name__)
model.init_db()
@app.route("/home",methods=["POST","GET"])
def home():
if request.method == 'POST':
return render_template('food.html',todos=[[[0,0],[0,0]],[[0,0],[0,0]],[[0,0],[0,0]]])
else:
return render_template('home.html')
@app.route("/food",methods=["GET","POST"])
def food():
if request.method == 'POST':
search = request.form['search']
todos = model.get_details(search)
print(todos)
return render_template('food.html', todos = todos)
else:
return render_template('food.html',todos=[[[0,0],[0,0]],[[0,0],[0,0]],[[0,0],[0,0]]])
# else:
# todos = model.show()
# return render_template('food.html',todos=todos)
if __name__ == "__main__":
app.run(debug=True)