summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLenczu Vex <kuba.lenczowski03@gmail.com>2025-04-05 12:22:31 +0200
committerLenczu Vex <kuba.lenczowski03@gmail.com>2025-04-05 12:23:44 +0200
commite0f8c7b78b58f18d73bed4310f99d4fb1ebb5508 (patch)
tree8891fde19df169fb6853a081d1364bec60336ce6
parent10905ea5ae9945fd5ae7b90a1cdfa083fd3fbdd1 (diff)
Swapped db to postgresqlHEADmaster
-rw-r--r--config.toml2
-rw-r--r--main.py8
-rw-r--r--requirements.txt2
3 files changed, 6 insertions, 6 deletions
diff --git a/config.toml b/config.toml
index 39ab275..54b91a2 100644
--- a/config.toml
+++ b/config.toml
@@ -2,7 +2,7 @@
host = "localhost"
user = ""
password = ""
-port = 3306
+port = 5432
database = ""
[session]
timeout = 14400
diff --git a/main.py b/main.py
index 8ead667..1fa7768 100644
--- a/main.py
+++ b/main.py
@@ -1,5 +1,5 @@
from flask import Flask, request, render_template, redirect, make_response
-import mariadb
+import psycopg2
import argon2
import tomllib as toml
import secrets
@@ -68,18 +68,18 @@ def login():
page = request.args.get("page")
username = request.form.get("username")
password = request.form.get("password")
- mariadb_connection = mariadb.connect(
+ psycopg2_connection = psycopg2.connect(
user=app.config["DB_USER"],
password=app.config["DB_PASSWORD"],
host=app.config["DB_HOST"],
port=app.config["DB_PORT"],
database=app.config["DB_NAME"],
)
- cur = mariadb_connection.cursor()
+ cur = psycopg2_connection.cursor()
cur.execute("SELECT password FROM users WHERE username = ?", (username,))
result = cur.fetchone()
cur.close()
- mariadb_connection.close()
+ psycopg2_connection.close()
if result is None:
return render_template("login.html", error="Invalid username or password"), 401
diff --git a/requirements.txt b/requirements.txt
index e8ad57f..69f9a67 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,7 +4,7 @@ click==8.1.8
Flask==3.1.0
itsdangerous==2.2.0
Jinja2==3.1.6
-mariadb==1.1.12
MarkupSafe==3.0.2
packaging==24.2
+psycopg2==2.9.10
Werkzeug==3.1.3