only load fixture data when starting the server w/ burnettk

This commit is contained in:
jasquat 2022-06-24 17:41:14 -04:00
parent b798ea4e45
commit bf291fbd8e
4 changed files with 10 additions and 8 deletions

View File

@ -10,7 +10,7 @@ set -o errtrace -o errexit -o nounset -o pipefail
# run migrations # run migrations
export FLASK_APP=/app/src/spiffworkflow_backend export FLASK_APP=/app/src/spiffworkflow_backend
if [ "${DOWNGRADE_DB:-}" = "true" ]; then if [[ "${DOWNGRADE_DB:-}" == "true" ]]; then
echo 'Downgrading database...' echo 'Downgrading database...'
poetry run flask db downgrade poetry run flask db downgrade
fi fi
@ -32,4 +32,4 @@ if [[ "${APPLICATION_ROOT:-}" != "/" ]]; then
fi fi
# THIS MUST BE THE LAST COMMAND! # THIS MUST BE THE LAST COMMAND!
exec poetry run gunicorn ${additional_args} --bind "0.0.0.0:$SPIFFWORKFLOW_BACKEND_PORT" --workers=3 --timeout 90 --log-level debug wsgi:app exec poetry run gunicorn ${additional_args} --bind "0.0.0.0:$port" --workers=3 --timeout 90 --log-level debug wsgi:app

View File

@ -17,5 +17,6 @@ if [[ -z "${BPMN_SPEC_ABSOLUTE_DIR:-}" ]]; then
fi fi
export FLASK_SESSION_SECRET_KEY=super_secret_key export FLASK_SESSION_SECRET_KEY=super_secret_key
export APPLICATION_ROOT="/"
FLASK_APP=src/spiffworkflow_backend poetry run flask run -p 7000 ./bin/boot_server_in_docker

View File

@ -14,7 +14,6 @@ from spiffworkflow_backend.routes.admin_blueprint.admin_blueprint import admin_b
from spiffworkflow_backend.routes.api_blueprint import api_blueprint from spiffworkflow_backend.routes.api_blueprint import api_blueprint
from spiffworkflow_backend.routes.process_api_blueprint import process_api_blueprint from spiffworkflow_backend.routes.process_api_blueprint import process_api_blueprint
from spiffworkflow_backend.routes.user_blueprint import user_blueprint from spiffworkflow_backend.routes.user_blueprint import user_blueprint
from spiffworkflow_backend.services.acceptance_test_fixtures import load_fixtures
def create_app() -> flask.app.Flask: def create_app() -> flask.app.Flask:
@ -56,8 +55,4 @@ def create_app() -> flask.app.Flask:
connexion_app.add_api("api.yml", base_path="/v1.0") connexion_app.add_api("api.yml", base_path="/v1.0")
if os.environ.get("SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA") == "true":
with app.app_context():
load_fixtures()
return app # type: ignore return app # type: ignore

View File

@ -1,4 +1,10 @@
"""This is my docstring.""" """This is my docstring."""
import os
from spiffworkflow_backend import create_app from spiffworkflow_backend import create_app
from spiffworkflow_backend.services.acceptance_test_fixtures import load_fixtures
app = create_app() app = create_app()
if os.environ.get("SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA") == "true":
with app.app_context():
load_fixtures()