try to set project root based on root_path w/ burnettk

This commit is contained in:
jasquat 2022-05-19 14:59:46 -04:00
parent a62aca04c8
commit 8e2423628f
3 changed files with 2 additions and 6 deletions

View File

@ -4,15 +4,12 @@ import os
from flask.app import Flask from flask.app import Flask
from werkzeug.utils import ImportStringError from werkzeug.utils import ImportStringError
project_root = os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "..", "..")
)
def setup_config(app: Flask) -> None: def setup_config(app: Flask) -> None:
"""Setup_config.""" """Setup_config."""
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config.from_object("spiff_workflow_webapp.config.default") app.config.from_object("spiff_workflow_webapp.config.default")
app.config["PROJECT_ROOT"] = os.path.join(app.root_path, "..", "..")
try: try:
app.config.from_object("spiff_workflow_webapp.config." + app.env) app.config.from_object("spiff_workflow_webapp.config." + app.env)

Binary file not shown.

View File

@ -10,7 +10,6 @@ from SpiffWorkflow.bpmn.serializer.workflow import BpmnWorkflowSerializer # typ
from SpiffWorkflow.camunda.serializer.task_spec_converters import UserTaskConverter # type: ignore from SpiffWorkflow.camunda.serializer.task_spec_converters import UserTaskConverter # type: ignore
from SpiffWorkflow.dmn.serializer.task_spec_converters import BusinessRuleTaskConverter # type: ignore from SpiffWorkflow.dmn.serializer.task_spec_converters import BusinessRuleTaskConverter # type: ignore
from spiff_workflow_webapp.config import project_root
from spiff_workflow_webapp.models.process_model import ProcessModel from spiff_workflow_webapp.models.process_model import ProcessModel
from spiff_workflow_webapp.spiff_workflow_connector import parse from spiff_workflow_webapp.spiff_workflow_connector import parse
from spiff_workflow_webapp.spiff_workflow_connector import run from spiff_workflow_webapp.spiff_workflow_connector import run
@ -35,7 +34,7 @@ def run_process() -> Response:
mimetype="application/json", mimetype="application/json",
) )
bpmn_spec_dir = os.path.join(project_root, current_app.config["BPMN_SPEC_DIR"]) bpmn_spec_dir = os.path.join(current_app.config["PROJECT_ROOT"], current_app.config["BPMN_SPEC_DIR"])
process = "order_product" process = "order_product"
dmn = [ dmn = [
os.path.join(bpmn_spec_dir, "product_prices.dmn"), os.path.join(bpmn_spec_dir, "product_prices.dmn"),