import psycopg2 from flask import Flask, render_template app = Flask(__name__) app.debug = True sql_statement = 'SELECT "id","title","alias","shortid","viewcount","lastchangeAt" FROM "Notes" ORDER BY "lastchangeAt" DESC;' DB_HOST = '192.168.0.3' DB_Name = 'hackmd' DB_USER = 'hackmd' DB_PASSWORD = 'osHx34e4aDazGsER' CODI_URL = "https://hackmd.wiai.de" @app.route("/") def main(): conn = psycopg2.connect(host=DB_HOST, database=DB_Name, user=DB_USER, password=DB_PASSWORD) cur = conn.cursor() cur.execute(sql_statement) notes = cur.fetchall() cur.close() conn.close() return render_template('index.html', notes=notes, host=CODI_URL) if __name__ == '__main__': app.run()