Skip to content

Commit

Permalink
From Flask 2.2 onwards, to run the app in debug mode we need to pass …
Browse files Browse the repository at this point in the history
…the debug flag.

This commit adds a task which pass the flag when running the app
  • Loading branch information
tim-s-ccs committed Feb 20, 2024
1 parent 1900297 commit 878c7eb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dmdevtools/invoke_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ def run_app(c):
c.run("flask run")


@task(show_environment, virtualenv)
def run_app_debug(c):
"""Run app [In DEBUG mode]"""
c.run("flask --debug run")


# Create collections for each kind of repo
# This probably isn't the best way to do this,
# but it seems to work.
Expand All @@ -192,6 +198,7 @@ def run_app(c):
_common_app_tasks = [
*_common_tasks,
run_app,
run_app_debug,
docker_build,
docker_push,
]
Expand Down Expand Up @@ -223,6 +230,7 @@ def _empty_task(*args, name, doc=None, **kwargs):
api_app_tasks = _Collection(
*_common_app_tasks,
_empty_task(requirements_dev, run_app, name="run-all", doc="Build and run app"),
_empty_task(requirements_dev, run_app_debug, name="run-all-debug", doc="Build and run app in debug mode"),
_empty_task(test_flake8, test_python, name="test", doc="Run all tests"),
)

Expand All @@ -238,6 +246,14 @@ def _empty_task(*args, name, doc=None, **kwargs):
name="run-all",
doc="Build and run app",
),
_empty_task(
requirements_dev,
npm_install,
frontend_build,
run_app_debug,
name="run-all-debug",
doc="Build and run app in debug mode",
),
_empty_task(
show_environment,
frontend_build,
Expand Down

0 comments on commit 878c7eb

Please sign in to comment.