-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
34 lines (28 loc) · 1.06 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
from flask import Flask,jsonify ,render_template ,request
from firebase import firebase
from forms import FirePut
app=Flask(__name__,template_folder="./templates")
firebase = firebase.FirebaseApplication('https://.firebaseio.com', None)
app.secret_key = 'this is a secet key dudes'
@app.route("/")
def index():
result = firebase.get('/', None)
print( jsonify(result))
return render_template("index.html")
count = 0
@app.route('/api/put', methods=['GET', 'POST'])
def fireput():
#if request.method == "POST":
form=FirePut()
if request.method == 'POST':
print ("i was here")
#if form.validate_on_submit():
global count
count += 1
putData = {"Name" : form.name.data, "phonenumber" : form.phonenumber.data, "product" : form.product.data,"email":form.email.data}
firebase.put("/", "" + str(count), putData)
return render_template("file.html", form=form, putData=putData)
print (form.name.data)
return render_template('users.html',form=form)
if __name__ == "__main__":
app.run(debug=True)