-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.py
More file actions
30 lines (23 loc) · 743 Bytes
/
hello.py
File metadata and controls
30 lines (23 loc) · 743 Bytes
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
from flask import Flask
from flask import render_template
from flask import request
from flask import redirect
from flask import url_for
app = Flask(__name__)
@app.route('/', methods = ['GET'])
def home():
return render_template('index.html')
#@app.route('/devices/0/turn_on', methods = ['POST'])
#def turn_on():
#state = request.values.get('color')
# return render_template('index_1.html', state = state)
@app.route('/device_states', methods = ['POST'])
def change():
state = request.values.get('color')
print(state)
return redirect(url_for('home'))
@app.route('/color', methods = ['POST'])
def get_color():
return redirect(url_for('home'))
if __name__ == "__main__":
app.run(host = '0.0.0.0', debug = True)