import os from flask import Flask, render_template, jsonify from rethinkdb import RethinkDB from routes.conditions import create_conditions_routes rethinkUrl = os.environ.get('RETHINKDB_URL') rethinkPort = os.environ.get('RETHINKDB_PORT') app = Flask(__name__) # Connect to RethinkDB r = RethinkDB() conn = r.connect(rethinkUrl, rethinkPort, db='finfree') create_conditions_routes(app, r, conn) conditionModel = { "id": { "type": "readonly", "name": "ID" }, "itemDescription": { "type": "string", "name": "Beschreibung" }, "itemName": { "type": "string", "name": "Name" } } @app.route('/') def index(): cursor = r.table("conditions").run(conn) conditions = list(cursor) return render_template('index.html', data={"conditions": { "data": conditions, "model": conditionModel }}) if __name__ == '__main__': app.run(host='0.0.0.0', port=8080, debug=True)