From c5feefe3540677c9a4a2d5d509f52b684cbcfbd9 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 11 Jan 2025 16:29:11 +0000 Subject: [PATCH] add load_dotenv and fix unix sock location --- backend/api/postgres_handler.py | 3 +++ backend/baseddata.service | 2 +- pyproject.toml | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/api/postgres_handler.py b/backend/api/postgres_handler.py index 64f0677..d0cb55e 100644 --- a/backend/api/postgres_handler.py +++ b/backend/api/postgres_handler.py @@ -1,6 +1,9 @@ from psycopg2.extras import RealDictCursor +from dotenv import load_dotenv import psycopg2, os +load_dotenv() + class PostgresHandler: def __init__(self): self.connection = self.connect_to_pg() diff --git a/backend/baseddata.service b/backend/baseddata.service index 98391c3..e729537 100644 --- a/backend/baseddata.service +++ b/backend/baseddata.service @@ -7,7 +7,7 @@ User=admin Group=www-data WorkingDirectory=/var/www/baseddata.io/backend 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] WantedBy=multi-user.target diff --git a/pyproject.toml b/pyproject.toml index 2b45d23..09c460a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,6 +15,7 @@ python = "^3.11" fastapi = "^0.115.4" uvicorn = "^0.32.0" psycopg2-binary = "^2.9.10" +load-dotenv = "^0.1.0" [build-system]