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') @views.route('/', methods=['POST']) def choice(): if request.form['submit_button'] == 'option_1': print("Eis usem lingge Gütterli uselah!") draw_beer(channel=r_ch1, wait=t_large_beer) if request.form['submit_button'] == 'option_2': 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']) def about(): return render_template('about.html') @views.route('/statistics', methods=['GET']) def statistics(): return render_template('statistics.html')