Refractor names

This commit is contained in:
Götz 2019-01-25 02:22:44 +01:00
parent 07881317aa
commit 33f237e8bf

16
main.py
View File

@ -1,27 +1,23 @@
import psycopg2
from flask import Flask, render_template, request
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;'
HOST = '192.168.0.3'
DB = 'hackmd'
USER = 'hackmd'
PASSWORD = 'osHx34e4aDazGsER'
DB_HOST = '192.168.0.3'
DB_Name = 'hackmd'
DB_USER = 'hackmd'
DB_PASSWORD = 'osHx34e4aDazGsER'
CODI_URL = "https://hackmd.wiai.de"
# lastchangeAt, alias, viewcount
@app.route("/")
def main():
conn = psycopg2.connect(host=HOST, database=DB, user=USER, password=PASSWORD)
conn = psycopg2.connect(host=DB_HOST, database=DB_Name, user=DB_USER, password=DB_PASSWORD)
cur = conn.cursor()
cur.execute(sql_statement)
print("The number of parts: ", cur.rowcount)
notes = cur.fetchall()
print(notes)
cur.close()
conn.close()
return render_template('index.html', notes=notes, host=CODI_URL)