From 584e0b6584c4762ee3d8ce70055311cde1ac0272 Mon Sep 17 00:00:00 2001 From: Maxime Alves LIRMM Date: Mon, 5 Oct 2020 11:29:17 +0200 Subject: [PATCH] [doc] cli/run.py --- halfapi/cli/run.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/halfapi/cli/run.py b/halfapi/cli/run.py index d9f3069..847dbcf 100644 --- a/halfapi/cli/run.py +++ b/halfapi/cli/run.py @@ -1,16 +1,23 @@ +#!/usr/bin/env python3 +""" +cli/domain.py Defines the "halfapi run" cli command +""" import sys import click import uvicorn from .cli import cli -from halfapi.cli.domain import list_routes -from halfapi.conf import (HOST, PORT, +from .domain import list_routes +from ..conf import (HOST, PORT, PRODUCTION, BASE_DIR, DOMAINS) @click.option('--host', default=None) @click.option('--port', default=None) @cli.command() def run(host, port): + """ + The "halfapi run" command + """ if not host: host = HOST @@ -20,14 +27,15 @@ def run(host, port): port = int(port) - debug = reload = not PRODUCTION + reload = not PRODUCTION log_level = 'info' if PRODUCTION else 'debug' click.echo('Launching application') sys.path.insert(0, BASE_DIR) - [ list_routes(domain) for domain in DOMAINS ] + for domain in DOMAINS: + list_routes(domain) uvicorn.run('halfapi.app:application', host=host,