diff --git a/lightrag/api/lightrag_server.py b/lightrag/api/lightrag_server.py index eddeaa5c..8ad232f0 100644 --- a/lightrag/api/lightrag_server.py +++ b/lightrag/api/lightrag_server.py @@ -19,7 +19,7 @@ from ascii_colors import ASCIIColors from fastapi.middleware.cors import CORSMiddleware from contextlib import asynccontextmanager from dotenv import load_dotenv -from .utils_api import ( +from lightrag.api.utils_api import ( get_api_key_dependency, parse_args, get_default_host, @@ -29,14 +29,14 @@ from lightrag import LightRAG from lightrag.types import GPTKeywordExtractionFormat from lightrag.api import __api_version__ from lightrag.utils import EmbeddingFunc -from .routers.document_routes import ( +from lightrag.api.routers.document_routes import ( DocumentManager, create_document_routes, run_scanning_process, ) -from .routers.query_routes import create_query_routes -from .routers.graph_routes import create_graph_routes -from .routers.ollama_api import OllamaAPI +from lightrag.api.routers.query_routes import create_query_routes +from lightrag.api.routers.graph_routes import create_graph_routes +from lightrag.api.routers.ollama_api import OllamaAPI from lightrag.utils import logger, set_verbose_debug from lightrag.kg.shared_storage import ( @@ -47,7 +47,9 @@ from lightrag.kg.shared_storage import ( ) # Load environment variables -load_dotenv(override=True) +# Updated to use the .env that is inside the current folder +# This update allows the user to put a different.env file for each lightrag folder +load_dotenv(".env", override=True) # Initialize config parser config = configparser.ConfigParser() diff --git a/lightrag/api/run_with_gunicorn.py b/lightrag/api/run_with_gunicorn.py index 903c5c17..cf9b3b91 100644 --- a/lightrag/api/run_with_gunicorn.py +++ b/lightrag/api/run_with_gunicorn.py @@ -9,6 +9,11 @@ import signal import pipmaster as pm from lightrag.api.utils_api import parse_args, display_splash_screen from lightrag.kg.shared_storage import initialize_share_data, finalize_share_data +from dotenv import load_dotenv + +# Updated to use the .env that is inside the current folder +# This update allows the user to put a different.env file for each lightrag folder +load_dotenv(".env") def check_and_install_dependencies():