From 7c3619783479c7c371d1178197f2f8963ee96cf6 Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 27 Jun 2022 16:59:59 -0400 Subject: [PATCH] support json files for forms and default to running the server locally to using not wsgi w/ burnettk --- bin/run_server_locally | 6 +++++- src/spiffworkflow_backend/models/file.py | 2 ++ wsgi.py | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/run_server_locally b/bin/run_server_locally index 79215922..1d9af679 100755 --- a/bin/run_server_locally +++ b/bin/run_server_locally @@ -19,4 +19,8 @@ fi export FLASK_SESSION_SECRET_KEY=super_secret_key export APPLICATION_ROOT="/" -./bin/boot_server_in_docker +if [[ -n "${SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA:-}" ]]; then + ./bin/boot_server_in_docker +else + FLASK_APP=src/spiffworkflow_backend poetry run flask run -p 7000 +fi diff --git a/src/spiffworkflow_backend/models/file.py b/src/spiffworkflow_backend/models/file.py index eae97a29..eb49b873 100644 --- a/src/spiffworkflow_backend/models/file.py +++ b/src/spiffworkflow_backend/models/file.py @@ -50,6 +50,7 @@ class FileType(SpiffEnum): docx = "docx" gif = "gif" jpg = "jpg" + json = "json" md = "md" pdf = "pdf" png = "png" @@ -73,6 +74,7 @@ CONTENT_TYPES = { "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "gif": "image/gif", "jpg": "image/jpeg", + "json": "application/json", "md": "text/plain", "pdf": "application/pdf", "png": "image/png", diff --git a/wsgi.py b/wsgi.py index 69a30024..060a0fd7 100644 --- a/wsgi.py +++ b/wsgi.py @@ -6,6 +6,8 @@ from spiffworkflow_backend.services.acceptance_test_fixtures import load_fixture app = create_app() +# this is in here because when we put it in the create_app function, +# it also loaded when we were running migrations, which resulted in a chicken/egg thing. if os.environ.get("SPIFFWORKFLOW_BACKEND_LOAD_FIXTURE_DATA") == "true": with app.app_context(): load_fixtures()