Teil 19 Flask.
This commit is contained in:
30
teil19/renderhtml/students.py
Normal file
30
teil19/renderhtml/students.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from flask import Flask,render_template
|
||||
from DBConnection import DBConnection
|
||||
import logging
|
||||
import configparser
|
||||
|
||||
logging.basicConfig( format='%(asctime)-15s [%(levelname)s] %(funcName)s: %(message)s', level=logging.DEBUG)
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('db.ini')
|
||||
|
||||
db_connection = DBConnection()
|
||||
db_connection.connect(config['pidb']['host'],config['pidb']['user'],config['pidb']['password'],config['pidb']['database'])
|
||||
app = Flask(__name__)
|
||||
|
||||
schueler = [
|
||||
{'name':'Simpson','vorname': 'Bart','highlight': 'True'},
|
||||
{'name':'Simpson','vorname':'Lisa',highlight': 'True'},
|
||||
{'name':'van Houten','vorname':'Milhouse','highlight':'False'},
|
||||
{'name':'Wiggum','vorname':'Ralph','highlight':'False'},
|
||||
{'name':'Jones','vorname':'Jimbo','highlight':'False'}
|
||||
]
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('students.html',schueler=schueler)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0',port=8085, debug=True)
|
||||
|
||||
|
Reference in New Issue
Block a user