z230
This commit is contained in:
14
db.py
Normal file
14
db.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from dotenv import load_dotenv
|
||||
import os, psycopg
|
||||
|
||||
load_dotenv()
|
||||
|
||||
def get_conn():
|
||||
return psycopg.connect(
|
||||
host=os.getenv("PG_HOST"),
|
||||
port=int(os.getenv("PG_PORT", 5432)),
|
||||
dbname=os.getenv("PG_DB"),
|
||||
user=os.getenv("PG_USER"),
|
||||
password=os.getenv("PG_PASS"),
|
||||
connect_timeout=5,
|
||||
)
|
||||
Reference in New Issue
Block a user