Преглед на файлове

fix: Move the setup_django command to a place where we already know what the actual subcommand is

Cristian преди 5 години
родител
ревизия
35a5700c73
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      archivebox/cli/__init__.py

+ 2 - 2
archivebox/cli/__init__.py

@@ -58,6 +58,8 @@ def run_subcommand(subcommand: str,
                    stdin: Optional[IO]=None,
                    stdin: Optional[IO]=None,
                    pwd: Union[Path, str, None]=None) -> None:
                    pwd: Union[Path, str, None]=None) -> None:
     """Run a given ArchiveBox subcommand with the given list of args"""
     """Run a given ArchiveBox subcommand with the given list of args"""
+    from ..config import setup_django
+    setup_django()
 
 
     module = import_module('.archivebox_{}'.format(subcommand), __package__)
     module = import_module('.archivebox_{}'.format(subcommand), __package__)
     module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
     module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
@@ -136,5 +138,3 @@ __all__ = (
 )
 )
 
 
 
 
-from ..config import setup_django
-setup_django()