File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 1+ import importlib
12from logging import getLogger
23from pathlib import Path
34from typing import Any , Union
@@ -45,6 +46,13 @@ def callback(
4546 """
4647
4748
49+ def _get_docs_url (uvicorn_path : str ) -> str :
50+ module_path , app_name = uvicorn_path .split (sep = ":" )
51+ module = importlib .import_module (module_path )
52+ app = getattr (module , app_name )
53+ return app .docs_url
54+
55+
4856def _run (
4957 path : Union [Path , None ] = None ,
5058 * ,
@@ -62,7 +70,13 @@ def _run(
6270 except FastAPICLIException as e :
6371 logger .error (str (e ))
6472 raise typer .Exit (code = 1 ) from None
65- serving_str = f"[dim]Serving at:[/dim] [link]http://{ host } :{ port } [/link]\n \n [dim]API docs:[/dim] [link]http://{ host } :{ port } /docs[/link]"
73+
74+ docs_url = _get_docs_url (use_uvicorn_app )
75+
76+ serving_str = (
77+ f"[dim]Serving at:[/dim] [link]http://{ host } :{ port } [/link]\n \n [dim]"
78+ f"API docs:[/dim] [link]http://{ host } :{ port } { docs_url } [/link]"
79+ )
6680
6781 if command == "dev" :
6882 panel = Panel (
You can’t perform that action at this time.
0 commit comments