-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
47 lines (36 loc) · 924 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from flask import Flask, render_template
import glob
import time
app = Flask(__name__)
app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension')
##Anything of modeling
RED = "100"
GREEN = "010"
BLUE = "001"
OFF = "000"
def writeColour(colour):
led = open("/dev/ledborg","w")
led.write(colour)
led.close()
def flash(colour):
writeColour(colour)
time.sleep(0.5)
writeColour(OFF)
@app.route("/", methods=['GET'])
def home():
flash(GREEN)
return render_template('index.jade')
@app.route("/list/", methods=['GET'])
def listPictures():
list = glob.glob("static/img/cam/*.jpg")
listPic = []
for file in list:
listPic.append("<img src='/" + file + "'>")
flash(BLUE)
return render_template('listPictures.jade', listPic=listPic)
@app.route("/current/",methods=['GET'])
def current():
flash(RED)
return render_template('current.jade')
if __name__ == "__main__":
app.run(debug=True,host="0.0.0.0")