-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
60 lines (42 loc) · 1.4 KB
/
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
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
55
56
57
58
59
60
from tkinter import Variable
from flask import Flask,redirect,url_for,render_template
import firebase_admin
from firebase_admin import credentials, firestore
cred = credentials.Certificate("servicesKey.json")
firebase_admin.initialize_app(cred)
app = Flask(__name__)
db = firestore.client()
@app.route("/")
def home():
return render_template("home.html")
@app.route("/<name>")
def red(name):
return "{name}".format(name=name)
@app.route("/redi")
def redfrom():
return redirect(url_for("red", name = "username"))
@app.route("/admin")
def end():
return "adminPage"
@app.route("/users")
def users():
_users = []
for user in db.collection('Users').get():
_users.append(user.to_dict())
return render_template("users.html",users = _users)
@app.route("/user/<user_id>")
def user(user_id):
_user = db.collection('Users').document(user_id).get().to_dict()
return render_template("user.html",user = _user)
@app.route("/products")
def products():
_products = []
for product in db.collection('Products').get():
_products.append(product.to_dict())
return render_template("products.html",products = _products)
@app.route("/product/<product_id>")
def product(product_id):
_product = db.collection('Products').document(product_id).get().to_dict()
return render_template("product.html",product = _product)
if __name__ == "__main__":
app.run(debug=True)