add load_dotenv and fix unix sock location

This commit is contained in:
Sam 2025-01-11 16:29:11 +00:00
parent e83fdd6502
commit c5feefe354
3 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,9 @@
from psycopg2.extras import RealDictCursor from psycopg2.extras import RealDictCursor
from dotenv import load_dotenv
import psycopg2, os import psycopg2, os
load_dotenv()
class PostgresHandler: class PostgresHandler:
def __init__(self): def __init__(self):
self.connection = self.connect_to_pg() self.connection = self.connect_to_pg()

View File

@ -7,7 +7,7 @@ User=admin
Group=www-data Group=www-data
WorkingDirectory=/var/www/baseddata.io/backend WorkingDirectory=/var/www/baseddata.io/backend
Environment="PATH=/var/www/baseddata.io/.venv/bin" Environment="PATH=/var/www/baseddata.io/.venv/bin"
ExecStart=/var/www/baseddata.io/.venv/bin/uvicorn --workers 4 --uds unix:baseddata.sock main:app ExecStart=/var/www/baseddata.io/.venv/bin/uvicorn --workers 4 --uds /var/sockets/baseddata.sock main:app
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -15,6 +15,7 @@ python = "^3.11"
fastapi = "^0.115.4" fastapi = "^0.115.4"
uvicorn = "^0.32.0" uvicorn = "^0.32.0"
psycopg2-binary = "^2.9.10" psycopg2-binary = "^2.9.10"
load-dotenv = "^0.1.0"
[build-system] [build-system]