turn handler into module
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
import json
|
||||
|
||||
from flask import Blueprint, render_template, request, flash, jsonify
|
||||
from gpio_handler import gpio_test, draw_beer
|
||||
|
||||
views = Blueprint('views', __name__)
|
||||
|
||||
# gpio channels
|
||||
r_ch1 = 26
|
||||
r_ch2 = 20
|
||||
r_ch3 = 21
|
||||
|
||||
# wait times
|
||||
t_large_beer = 6
|
||||
t_small_beer = 2
|
||||
|
||||
@views.route('/', methods=['GET'])
|
||||
def render():
|
||||
return render_template('beertap.html')
|
||||
@@ -11,9 +21,11 @@ def render():
|
||||
@views.route('/', methods=['POST'])
|
||||
def choice():
|
||||
if request.form['submit_button'] == 'option_1':
|
||||
print("Es Grosses uselah!")
|
||||
print("Eis usem lingge Gütterli uselah!")
|
||||
draw_beer(channel=r_ch1, wait=t_large_beer)
|
||||
if request.form['submit_button'] == 'option_2':
|
||||
print("Es Chliises uselah!")
|
||||
print("Eis usem rächte Gütterli uselah!")
|
||||
draw_beer(channel=r_ch2, wait=t_large_beer)
|
||||
return render_template('beertap.html')
|
||||
|
||||
@views.route('/about', methods=['GET'])
|
||||
|
||||
Reference in New Issue
Block a user