Refractor names
This commit is contained in:
parent
07881317aa
commit
33f237e8bf
16
main.py
16
main.py
@ -1,27 +1,23 @@
|
|||||||
import psycopg2
|
import psycopg2
|
||||||
from flask import Flask, render_template, request
|
from flask import Flask, render_template
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.debug = True
|
app.debug = True
|
||||||
|
|
||||||
sql_statement = 'SELECT "id","title","alias","shortid","viewcount","lastchangeAt" FROM "Notes" ORDER BY "lastchangeAt" DESC;'
|
sql_statement = 'SELECT "id","title","alias","shortid","viewcount","lastchangeAt" FROM "Notes" ORDER BY "lastchangeAt" DESC;'
|
||||||
HOST = '192.168.0.3'
|
DB_HOST = '192.168.0.3'
|
||||||
DB = 'hackmd'
|
DB_Name = 'hackmd'
|
||||||
USER = 'hackmd'
|
DB_USER = 'hackmd'
|
||||||
PASSWORD = 'osHx34e4aDazGsER'
|
DB_PASSWORD = 'osHx34e4aDazGsER'
|
||||||
CODI_URL = "https://hackmd.wiai.de"
|
CODI_URL = "https://hackmd.wiai.de"
|
||||||
|
|
||||||
|
|
||||||
# lastchangeAt, alias, viewcount
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def main():
|
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 = conn.cursor()
|
||||||
cur.execute(sql_statement)
|
cur.execute(sql_statement)
|
||||||
print("The number of parts: ", cur.rowcount)
|
|
||||||
notes = cur.fetchall()
|
notes = cur.fetchall()
|
||||||
print(notes)
|
|
||||||
cur.close()
|
cur.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
return render_template('index.html', notes=notes, host=CODI_URL)
|
return render_template('index.html', notes=notes, host=CODI_URL)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user