-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
54 lines (41 loc) · 1.38 KB
/
main.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 Flask, render_template, url_for
from cs50 import SQL
app = Flask(__name__) #creating a Flask class object
db = SQL ( "sqlite:///database.db" )
@app.route('/')
def hello():
return render_template('home.html')
@app.route('/groceries')
def groceries():
items = db.execute("SELECT * FROM GROCERY")
return render_template('items.html',items = items)
@app.route('/food')
def food():
items = db.execute("SELECT * FROM FOOD")
return render_template('items.html',items = items)
@app.route('/fruits')
def fruits():
items = db.execute("SELECT * FROM FRUITS")
return render_template('items.html',items = items)
@app.route('/stationary')
def stationary():
items = db.execute("SELECT * FROM STATIONARY")
return render_template('items.html',items = items)
@app.route('/dairy')
def dairy():
items = db.execute("SELECT * FROM DAIRY")
return render_template('items.html',items = items)
@app.route('/crafts')
def crafts():
items = db.execute("SELECT * FROM CRAFTS")
return render_template('items.html',items = items)
@app.route('/fashion')
def fashion():
items = db.execute("SELECT * FROM FASHION")
return render_template('items.html',items = items)
@app.route('/diwali')
def diwali():
items = db.execute("SELECT * FROM DIWALI")
return render_template('items.html',items = items)
if __name__ =='__main__':
app.run(debug = True)