(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None)
| 15 | |
| 16 | @docstring(server.__doc__) |
| 17 | def main(args: Optional[List[str]]=None, stdin: Optional[IO]=None, pwd: Optional[str]=None) -> None: |
| 18 | parser = argparse.ArgumentParser( |
| 19 | prog=__command__, |
| 20 | description=server.__doc__, |
| 21 | add_help=True, |
| 22 | formatter_class=SmartFormatter, |
| 23 | ) |
| 24 | parser.add_argument( |
| 25 | 'runserver_args', |
| 26 | nargs='*', |
| 27 | type=str, |
| 28 | default=[BIND_ADDR], |
| 29 | help='Arguments to pass to Django runserver' |
| 30 | ) |
| 31 | parser.add_argument( |
| 32 | '--reload', |
| 33 | action='store_true', |
| 34 | help='Enable auto-reloading when code or templates change', |
| 35 | ) |
| 36 | parser.add_argument( |
| 37 | '--debug', |
| 38 | action='store_true', |
| 39 | help='Enable DEBUG=True mode with more verbose errors', |
| 40 | ) |
| 41 | parser.add_argument( |
| 42 | '--nothreading', |
| 43 | action='store_true', |
| 44 | help='Force runserver to run in single-threaded mode', |
| 45 | ) |
| 46 | parser.add_argument( |
| 47 | '--init', |
| 48 | action='store_true', |
| 49 | help='Run a full archivebox init/upgrade before starting the server', |
| 50 | ) |
| 51 | parser.add_argument( |
| 52 | '--quick-init', '-i', |
| 53 | action='store_true', |
| 54 | help='Run quick archivebox init/upgrade before starting the server', |
| 55 | ) |
| 56 | parser.add_argument( |
| 57 | '--createsuperuser', |
| 58 | action='store_true', |
| 59 | help='Run archivebox manage createsuperuser before starting the server', |
| 60 | ) |
| 61 | command = parser.parse_args(args or ()) |
| 62 | reject_stdin(__command__, stdin) |
| 63 | |
| 64 | server( |
| 65 | runserver_args=command.runserver_args + (['--nothreading'] if command.nothreading else []), |
| 66 | reload=command.reload, |
| 67 | debug=command.debug, |
| 68 | init=command.init, |
| 69 | quick_init=command.quick_init, |
| 70 | createsuperuser=command.createsuperuser, |
| 71 | out_dir=pwd or OUTPUT_DIR, |
| 72 | ) |
| 73 | |
| 74 |
no test coverage detected