Bewaesserungsanlage/Webserver/__init__.py

41 lines
1.0 KiB
Python

from flask import Flask, render_template, request, redirect, url_for
from flask_navigation import Navigation
app = Flask("Bewässerungssystem")
nav = Navigation(app)
nav.Bar('top', [
nav.Item('Dashboard', 'showDashboard'),
nav.Item('Bewässerungszonen', 'showZones'),
nav.Item('Sperrzeiteneinstellung', 'showTimes'),
nav.Item('Systemeinestellungen', 'showSystem')
#nav.Item('Gfg', 'gfg', {'page': 5}), #(example with pages)
])
#Example Route with pages:
#@app.route('/gfg/<int:page>')
#def gfg(page):
# return render_template('gfg.html', page=page)
@app.route('/')
def startPage():
return redirect(url_for('showDashboard'))
@app.route('/dashboard')
def showDashboard():
return render_template('dashboard.html')
@app.route('/zonen')
def showZones():
return render_template('zones.html')
@app.route('/times')
def showTimes():
return render_template('times.html')
@app.route('/system')
def showSystem():
return render_template('system.html')
if __name__ == "__main__":
app.run(debug=True, port=80)