Home / Function/ run_command() — flask Function Reference

run_command() — flask Function Reference

Architecture documentation for the run_command() function in cli.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  112697fd_abe3_7738_1bc4_8f3d27bbbb68["run_command()"]
  a96499c3_f8a9_e782_f156_1c1ee4a86c69["cli.py"]
  112697fd_abe3_7738_1bc4_8f3d27bbbb68 -->|defined in| a96499c3_f8a9_e782_f156_1c1ee4a86c69
  6cabef6b_f1ce_76af_5916_c4e9a439548c["load_app()"]
  112697fd_abe3_7738_1bc4_8f3d27bbbb68 -->|calls| 6cabef6b_f1ce_76af_5916_c4e9a439548c
  d374b506_8b36_b4e6_3147_5db4fa8f8d91["app()"]
  112697fd_abe3_7738_1bc4_8f3d27bbbb68 -->|calls| d374b506_8b36_b4e6_3147_5db4fa8f8d91
  aa03072d_fb08_de41_1ce0_535b2a2f9d00["get_debug_flag()"]
  112697fd_abe3_7738_1bc4_8f3d27bbbb68 -->|calls| aa03072d_fb08_de41_1ce0_535b2a2f9d00
  6c622a4d_f232_2fcf_ef52_d2fd24dc70b7["show_server_banner()"]
  112697fd_abe3_7738_1bc4_8f3d27bbbb68 -->|calls| 6c622a4d_f232_2fcf_ef52_d2fd24dc70b7
  style 112697fd_abe3_7738_1bc4_8f3d27bbbb68 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/cli.py lines 935–993

def run_command(
    info: ScriptInfo,
    host: str,
    port: int,
    reload: bool,
    debugger: bool,
    with_threads: bool,
    cert: ssl.SSLContext | tuple[str, str | None] | t.Literal["adhoc"] | None,
    extra_files: list[str] | None,
    exclude_patterns: list[str] | None,
) -> None:
    """Run a local development server.

    This server is for development purposes only. It does not provide
    the stability, security, or performance of production WSGI servers.

    The reloader and debugger are enabled by default with the '--debug'
    option.
    """
    try:
        app: WSGIApplication = info.load_app()  # pyright: ignore
    except Exception as e:
        if is_running_from_reloader():
            # When reloading, print out the error immediately, but raise
            # it later so the debugger or server can handle it.
            traceback.print_exc()
            err = e

            def app(
                environ: WSGIEnvironment, start_response: StartResponse
            ) -> cabc.Iterable[bytes]:
                raise err from None

        else:
            # When not reloading, raise the error immediately so the
            # command fails.
            raise e from None

    debug = get_debug_flag()

    if reload is None:
        reload = debug

    if debugger is None:
        debugger = debug

    show_server_banner(debug, info.app_import_path)

    run_simple(
        host,
        port,
        app,
        use_reloader=reload,
        use_debugger=debugger,
        threaded=with_threads,
        ssl_context=cert,
        extra_files=extra_files,
        exclude_patterns=exclude_patterns,
    )

Subdomains

Defined In

Frequently Asked Questions

What does run_command() do?
run_command() is a function in the flask codebase, defined in src/flask/cli.py.
Where is run_command() defined?
run_command() is defined in src/flask/cli.py at line 935.
What does run_command() call?
run_command() calls 4 function(s): app, get_debug_flag, load_app, show_server_banner.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free