From 2aeccd44bed4974e31cb02bf86545e548782512c Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 27 Feb 2023 18:49:30 +0400 Subject: [PATCH] Loading .env_debug in Makefile; make clean command bugfix --- .env_debug | 1 + Makefile | 5 +++-- app/common.py | 9 +-------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.env_debug b/.env_debug index 1e3e50b..14fc4ff 100644 --- a/.env_debug +++ b/.env_debug @@ -1,3 +1,4 @@ +DEBUG=true SESSION_KEY=debug CSRF_KEY=debug DB_HOST=localhost diff --git a/Makefile b/Makefile index da86601..7bfd8bf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ dev: - DEBUG="true" python3 -m uvicorn main:app --reload + python3 -m dotenv -f .env_debug run \ + python3 -m uvicorn main:app --reload prod: python3 -m uvicorn main:app @@ -16,6 +17,6 @@ docker: clean: rm -rf app/__pycache__ - rm -rf app/paths/__pycache__ + rm -rf app/*/__pycache__ rm -rf __pycache__ rm -rf .mypy_cache diff --git a/app/common.py b/app/common.py index efeaf9b..11b46b1 100644 --- a/app/common.py +++ b/app/common.py @@ -15,17 +15,10 @@ templates_dir = str( static_dir = str( file_dir.parent / 'static' ) -debug_env = str( - file_dir.parent / '.env_debug' -) - - -is_debug = bool(os.getenv('DEBUG')) -if is_debug: - load_dotenv(debug_env) class Settings(BaseSettings): + debug: bool = False session_key: str = secrets.token_hex(32) csrf_key: str = secrets.token_hex(32)