feat: auto disable debug on deploy

This commit is contained in:
Hazel 2024-04-10 12:18:07 +02:00
parent f009bf7bb8
commit db8e54cd1c
6 changed files with 20 additions and 3 deletions

2
.gitignore vendored
View File

@ -16,3 +16,5 @@ venv
.idea/aws.xml .idea/aws.xml
windows windows
.env

View File

@ -17,6 +17,7 @@
"python.formatting.provider": "none", "python.formatting.provider": "none",
"cSpell.words": [ "cSpell.words": [
"Bandcamp", "Bandcamp",
"dotenv",
"levenshtein", "levenshtein",
"OKBLUE" "OKBLUE"
] ]

View File

@ -378,6 +378,9 @@ class Page:
if not (isinstance(music_object, Song) and self.NO_ADDITIONAL_DATA_FROM_SONG): if not (isinstance(music_object, Song) and self.NO_ADDITIONAL_DATA_FROM_SONG):
self.fetch_details(music_object=music_object, stop_at_level=1) self.fetch_details(music_object=music_object, stop_at_level=1)
if isinstance(music_object, Song):
trace(music_object.option_string)
naming_dict.add_object(music_object) naming_dict.add_object(music_object)
if isinstance(music_object, Song): if isinstance(music_object, Song):

View File

@ -3,7 +3,7 @@ from pathlib import Path
import json import json
import logging import logging
from .shared import DEBUG, DEBUG_LOGGING, DEBUG_DUMP from .shared import DEBUG, DEBUG_LOGGING, DEBUG_DUMP, DEBUG_TRACE
from .config import config, read_config, write_config from .config import config, read_config, write_config
from .enums.colors import BColors from .enums.colors import BColors
from .path_manager import LOCATIONS from .path_manager import LOCATIONS
@ -47,7 +47,7 @@ def dump_to_file(file_name: str, payload: str, is_json: bool = False, exit_after
def trace(msg: str): def trace(msg: str):
if DEBUG_LOGGING: if DEBUG_TRACE:
logging.debug(msg) logging.debug(msg)
output("trace: " + msg, BColors.OKBLUE) output("trace: " + msg, BColors.OKBLUE)

View File

@ -1,10 +1,20 @@
import random import random
from dotenv import load_dotenv
from pathlib import Path
import os
from .path_manager import LOCATIONS from .path_manager import LOCATIONS
from .config import main_settings from .config import main_settings
DEBUG = True if not load_dotenv(Path(__file__).parent.parent.parent / ".env"):
load_dotenv(Path(__file__).parent.parent.parent / ".env.example")
__stage__ = os.getenv("STAGE", "prod")
DEBUG = __stage__ == "dev" and True
DEBUG_LOGGING = DEBUG and False DEBUG_LOGGING = DEBUG and False
DEBUG_TRACE = DEBUG and True
DEBUG_YOUTUBE_INITIALIZING = DEBUG and False DEBUG_YOUTUBE_INITIALIZING = DEBUG and False
DEBUG_PAGES = DEBUG and False DEBUG_PAGES = DEBUG and False
DEBUG_DUMP = DEBUG and True DEBUG_DUMP = DEBUG and True

View File

@ -51,6 +51,7 @@ dependencies = [
"transliterate~=1.10.2", "transliterate~=1.10.2",
"pycountry~=24.0.1", "pycountry~=24.0.1",
"python-dotenv~=1.0.1",
"tqdm~=4.65.0", "tqdm~=4.65.0",
"platformdirs~=4.2.0", "platformdirs~=4.2.0",
"pathvalidate~=2.5.2", "pathvalidate~=2.5.2",