@@ -68,19 +68,34 @@ def _run(
6868 except FastAPICLIException as e :
6969 logger .error (str (e ))
7070 raise typer .Exit (code = 1 ) from None
71- serving_str = f"[dim]Serving at:[/dim] [link]http://{ host } :{ port } [/link]\n \n [dim]API docs:[/dim] [link]http://{ host } :{ port } /docs[/link]"
71+
72+ serving_str = f"[dim]Serving at:[/dim] [link]http://{ host } :{ port } [/link]\n \n "
73+
74+ if app .openapi_url and (app .docs_url or app .redoc_url ):
75+ serving_str += "[dim]API docs:[/dim] "
76+
77+ if app .docs_url :
78+ serving_str += f"[link]http://{ host } :{ port } { app .docs_url } [/link]\n "
79+
80+ if app .docs_url and app .redoc_url :
81+ serving_str += " " * 10
82+
83+ if app .redoc_url :
84+ serving_str += f"[link]http://{ host } :{ port } { app .redoc_url } [/link]\n \n "
85+ else :
86+ serving_str += "\n "
7287
7388 if command == "dev" :
7489 panel = Panel (
75- f"{ serving_str } \n \n [dim]Running in development mode, for production use:[/dim] \n \n [b]fastapi run[/b]" ,
90+ f"{ serving_str } [dim]Running in development mode, for production use:[/dim] \n \n [b]fastapi run[/b]" ,
7691 title = "FastAPI CLI - Development mode" ,
7792 expand = False ,
7893 padding = (1 , 2 ),
7994 style = "black on yellow" ,
8095 )
8196 else :
8297 panel = Panel (
83- f"{ serving_str } \n \n [dim]Running in production mode, for development use:[/dim] \n \n [b]fastapi dev[/b]" ,
98+ f"{ serving_str } [dim]Running in production mode, for development use:[/dim] \n \n [b]fastapi dev[/b]" ,
8499 title = "FastAPI CLI - Production mode" ,
85100 expand = False ,
86101 padding = (1 , 2 ),
@@ -92,7 +107,7 @@ def _run(
92107 "Could not import Uvicorn, try running 'pip install uvicorn'"
93108 ) from None
94109 uvicorn .run (
95- app = use_uvicorn_app ,
110+ app = import_string ,
96111 host = host ,
97112 port = port ,
98113 reload = reload ,
0 commit comments