Aktualizovat sk1/backend/app.py
This commit is contained in:
parent
55dc649360
commit
fb91012c70
@ -16,12 +16,12 @@ CORS(app)
|
||||
app.config['CACHE_TYPE'] = 'SimpleCache'
|
||||
cache = Cache(app)
|
||||
|
||||
# Database connection
|
||||
|
||||
DATABASE_URL = os.environ.get('DATABASE_URL')
|
||||
conn = psycopg2.connect(DATABASE_URL)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# Initialize DB
|
||||
|
||||
cursor.execute('''
|
||||
CREATE TABLE IF NOT EXISTS history (
|
||||
id SERIAL PRIMARY KEY,
|
||||
@ -47,7 +47,7 @@ def get_current_time():
|
||||
return datetime.now(tz)
|
||||
|
||||
def sync_history_file():
|
||||
# Synchronizácia history.json so všetkými záznamami z databázy
|
||||
|
||||
cursor.execute("SELECT text, prediction, timestamp FROM history ORDER BY timestamp DESC")
|
||||
rows = cursor.fetchall()
|
||||
history = [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user