From f3c12f516efcd01e070b99e37ea94c1453231d76 Mon Sep 17 00:00:00 2001 From: "Maxime Alves LIRMM@home" Date: Mon, 4 Oct 2021 20:11:32 +0200 Subject: [PATCH] [cli] run does not reload modules by default --- halfapi/cli/run.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/halfapi/cli/run.py b/halfapi/cli/run.py index a923edf..fc4c5ac 100644 --- a/halfapi/cli/run.py +++ b/halfapi/cli/run.py @@ -14,8 +14,9 @@ from ..conf import (PROJECT_NAME, HOST, PORT, @click.option('--host', default=None) @click.option('--port', default=None) +@click.option('--reload', default=False) @cli.command() -def run(host, port): +def run(host, port, reload): """ The "halfapi run" command """ @@ -28,7 +29,10 @@ def run(host, port): port = int(port) - reload = not PRODUCTION + if PRODUCTION: + reload = False + raise Exception('Can\'t use live code reload in production') + log_level = 'info' if PRODUCTION else LOGLEVEL click.echo(f'Launching application {PROJECT_NAME}')