Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(description="launch Taskard server")
    parser.add_argument("--mode",
            help="set configuration mode (takes precedence over "
                    "TASKARD_CONFIG envionment variable)")
    parser.add_argument("--dev", action="store_true",
            help="activate development mode - short for `--mode=development`")
    parser.add_argument("-p", "--port", nargs="?", default="5000",
            help="specify the port number to listen on (defaults to 5000)")
    args = parser.parse_args()

    # NB: configuration mode must be set before application is imported
    if args.dev:
        os.environ["TASKARD_CONFIG"] = "development"
    elif args.mode:
        os.environ["TASKARD_CONFIG"] = args.mode

    try:
        from taskard.web import app
    except ConfigurationError as err:
        print("ERROR: %s" % err, file=sys.stderr)
        return False

    if args.dev:
        configure_sql_logging()

    print(" * Starting up in %s mode" % app.config_mode)
    app.run(port=int(args.port))
    return True
Exemplo n.º 2
0
Arquivo: shell.py Projeto: FND/taskard
import atexit

from taskard.web import app, DB
from taskard import commands as cmd
from taskard import models
from taskard.logging import configure_sql_logging

ctx = app.app_context()
ctx.push()
atexit.register(ctx.pop)
configure_sql_logging()