@@ -68,19 +68,34 @@ def _run(
68
68
except FastAPICLIException as e :
69
69
logger .error (str (e ))
70
70
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 "
72
87
73
88
if command == "dev" :
74
89
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]" ,
76
91
title = "FastAPI CLI - Development mode" ,
77
92
expand = False ,
78
93
padding = (1 , 2 ),
79
94
style = "black on yellow" ,
80
95
)
81
96
else :
82
97
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]" ,
84
99
title = "FastAPI CLI - Production mode" ,
85
100
expand = False ,
86
101
padding = (1 , 2 ),
@@ -92,7 +107,7 @@ def _run(
92
107
"Could not import Uvicorn, try running 'pip install uvicorn'"
93
108
) from None
94
109
uvicorn .run (
95
- app = use_uvicorn_app ,
110
+ app = import_string ,
96
111
host = host ,
97
112
port = port ,
98
113
reload = reload ,
0 commit comments