From 6aef1dd98d1726ce9197b3d5b4b395ce517ffe8f Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Sun, 28 Feb 2021 22:53:23 -0500 Subject: [PATCH] dont check db if init is pending --- Dockerfile | 2 +- archivebox/cli/__init__.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a31d36a0..b11d3382 100644 --- a/Dockerfile +++ b/Dockerfile @@ -121,4 +121,4 @@ HEALTHCHECK --interval=30s --timeout=20s --retries=15 \ CMD curl --silent 'http://localhost:8000/admin/login/' || exit 1 ENTRYPOINT ["dumb-init", "--", "/app/bin/docker_entrypoint.sh"] -CMD ["archivebox", "server", "0.0.0.0:8000"] +CMD ["archivebox", "server", "--quick-init", "0.0.0.0:8000"] diff --git a/archivebox/cli/__init__.py b/archivebox/cli/__init__.py index f9a55efd..890065a4 100644 --- a/archivebox/cli/__init__.py +++ b/archivebox/cli/__init__.py @@ -63,7 +63,11 @@ def run_subcommand(subcommand: str, if subcommand not in meta_cmds: from ..config import setup_django - setup_django(in_memory_db=subcommand in fake_db, check_db=subcommand in archive_cmds) + + cmd_requires_db = subcommand in archive_cmds + init_pending = '--init' in subcommand_args or '--quick-init' in subcommand_args + + setup_django(in_memory_db=subcommand in fake_db, check_db=cmd_requires_db and not init_pending) module = import_module('.archivebox_{}'.format(subcommand), __package__) module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore