finfree-be/app.py

27 lines
659 B
Python

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)
@app.route('/')
def index():
cursor = r.table("conditions").run(conn)
conditions = list(cursor)
return render_template('index.html', data={"conditions": conditions})
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080, debug=True)