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.
This commit is contained in:
Ben Busby 2021-03-18 11:06:03 -04:00
parent c429046c0d
commit bbbcc08927
No known key found for this signature in database
GPG Key ID: 3B08611DF6E62ED2
5 changed files with 5 additions and 5 deletions

View File

@ -18,13 +18,13 @@ app.config['VERSION_NUMBER'] = '0.3.1'
app.config['APP_ROOT'] = os.getenv( app.config['APP_ROOT'] = os.getenv(
'APP_ROOT', 'APP_ROOT',
os.path.dirname(os.path.abspath(__file__))) 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( app.config['STATIC_FOLDER'] = os.getenv(
'STATIC_FOLDER', 'STATIC_FOLDER',
os.path.join(app.config['APP_ROOT'], 'static')) 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( app.config['CONFIG_PATH'] = os.getenv(
'CONFIG_VOLUME', 'CONFIG_VOLUME',
os.path.join(app.config['STATIC_FOLDER'], 'config')) os.path.join(app.config['STATIC_FOLDER'], 'config'))

1
run
View File

@ -15,6 +15,7 @@ export STATIC_FOLDER="$APP_ROOT/static"
# Check for regular vs test run # Check for regular vs test run
if [[ "$SUBDIR" == "test" ]]; then if [[ "$SUBDIR" == "test" ]]; then
# Set up static files for testing # Set up static files for testing
rm -rf "$STATIC_FOLDER"
ln -s "$SCRIPT_DIR/app/static" "$STATIC_FOLDER" ln -s "$SCRIPT_DIR/app/static" "$STATIC_FOLDER"
pytest -sv pytest -sv
else else

View File

@ -1 +0,0 @@
../app/misc/