Move .env file to config dir, change db path for improved project structure

* Change path of db and token to `data` which helps to sperate source
  code from data files like `tokens.json` & `spotify_scraped.db`
* Change path of `.env` `src/env/` to `config/` for the same reason as
  mentioned above
* Added the newly created files to `.gitigore` accordingly
This commit is contained in:
Chris Kiriakou
2025-03-21 18:57:13 +01:00
parent 2d4e951693
commit 38e0c69bea
3 changed files with 3 additions and 6 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ from urllib.parse import parse_qs, urlencode, urlparse
import dotenv
import requests
TOKEN_FILE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'env', 'tokens.json')
TOKEN_FILE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../data', 'tokens.json')
def simple_authenticate(grant_type: str = "client_credentials") -> str:
@@ -102,7 +102,7 @@ def _read_env_file() -> tuple:
:return: tuple
"""
current_dir = os.path.dirname(os.path.abspath(__file__))
dotenv_folder_path = os.path.join(current_dir, 'env')
dotenv_folder_path = os.path.join(current_dir, '../config')
dotenv_path = os.path.join(dotenv_folder_path, '.env')
contents = dotenv.dotenv_values(dotenv_path=dotenv_path)
spotify_client_id = contents['SPOTIFY_CLIENT_ID']