From bbbcc08927a07e0d12dcf35c129ac69db7b6fb8d Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Thu, 18 Mar 2021 11:06:03 -0400 Subject: [PATCH] Refactor app/misc/*.json -> app/static/settings/*.json The country/language json files are used for user config settings, so the "misc" name didn't really make sense. Also moved these to the static folder to make testing easier. --- app/__init__.py | 8 ++++---- app/{misc => static/settings}/countries.json | 0 app/{misc => static/settings}/languages.json | 0 run | 1 + test/misc | 1 - 5 files changed, 5 insertions(+), 5 deletions(-) rename app/{misc => static/settings}/countries.json (100%) rename app/{misc => static/settings}/languages.json (100%) delete mode 120000 test/misc diff --git a/app/__init__.py b/app/__init__.py index bff20fc..2af4cac 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -18,13 +18,13 @@ app.config['VERSION_NUMBER'] = '0.3.1' app.config['APP_ROOT'] = os.getenv( 'APP_ROOT', os.path.dirname(os.path.abspath(__file__))) -app.config['LANGUAGES'] = json.load(open( - os.path.join(app.config['APP_ROOT'], 'misc/languages.json'))) -app.config['COUNTRIES'] = json.load(open( - os.path.join(app.config['APP_ROOT'], 'misc/countries.json'))) app.config['STATIC_FOLDER'] = os.getenv( 'STATIC_FOLDER', os.path.join(app.config['APP_ROOT'], 'static')) +app.config['LANGUAGES'] = json.load(open( + os.path.join(app.config['STATIC_FOLDER'], 'settings/languages.json'))) +app.config['COUNTRIES'] = json.load(open( + os.path.join(app.config['STATIC_FOLDER'], 'settings/countries.json'))) app.config['CONFIG_PATH'] = os.getenv( 'CONFIG_VOLUME', os.path.join(app.config['STATIC_FOLDER'], 'config')) diff --git a/app/misc/countries.json b/app/static/settings/countries.json similarity index 100% rename from app/misc/countries.json rename to app/static/settings/countries.json diff --git a/app/misc/languages.json b/app/static/settings/languages.json similarity index 100% rename from app/misc/languages.json rename to app/static/settings/languages.json diff --git a/run b/run index 2ac71a4..4ace594 100755 --- a/run +++ b/run @@ -15,6 +15,7 @@ export STATIC_FOLDER="$APP_ROOT/static" # Check for regular vs test run if [[ "$SUBDIR" == "test" ]]; then # Set up static files for testing + rm -rf "$STATIC_FOLDER" ln -s "$SCRIPT_DIR/app/static" "$STATIC_FOLDER" pytest -sv else diff --git a/test/misc b/test/misc deleted file mode 120000 index 4b8163d..0000000 --- a/test/misc +++ /dev/null @@ -1 +0,0 @@ -../app/misc/ \ No newline at end of file