diff --git a/config.py b/config.py index 33deeed..3d5fc2f 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,18 @@ import os +import sys from dotenv import load_dotenv -load_dotenv() +def resource_path(relative_path): + """ Get absolute path to resource, works for dev and for PyInstaller """ + try: + # PyInstaller creates a temp folder in _MEIPASS + base_path = sys._MEIPASS + except Exception: + base_path = os.path.abspath(".") + return os.path.join(base_path, relative_path) + +# Загружаем .env из правильного места +env_path = resource_path('.env') +load_dotenv(dotenv_path=env_path) MAIN_URL = os.getenv("MAIN_URL", "https://example.com") \ No newline at end of file diff --git a/dist/main.exe b/dist/main.exe index ce4ff98..8f31f7e 100644 Binary files a/dist/main.exe and b/dist/main.exe differ