File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ def _run(
126126
127127 module_data = import_data .module_data
128128 import_string = import_data .import_string
129+ fastapi_app = import_data .fastapi_app
129130
130131 toolkit .print (f"Importing from { module_data .extra_sys_path } " )
131132 toolkit .print_line ()
@@ -152,15 +153,32 @@ def _run(
152153 )
153154
154155 url = f"http://{ host } :{ port } "
155- url_docs = f"{ url } /docs"
156+ docs_url = ""
157+
158+ if fastapi_app .openapi_url and (fastapi_app .docs_url or fastapi_app .redoc_url ):
159+ if fastapi_app .docs_url :
160+ docs_url += (
161+ f"[link={ url } { fastapi_app .docs_url } ]{ url } { fastapi_app .docs_url } [/]"
162+ )
163+
164+ if fastapi_app .docs_url and fastapi_app .redoc_url :
165+ docs_url += " or "
166+
167+ if fastapi_app .redoc_url :
168+ docs_url += f"[link={ url } { fastapi_app .redoc_url } ]{ url } { fastapi_app .redoc_url } [/]"
156169
157170 toolkit .print_line ()
158171 toolkit .print (
159172 f"Server started at [link={ url } ]{ url } [/]" ,
160- f"Documentation at [link={ url_docs } ]{ url_docs } [/]" ,
161173 tag = "server" ,
162174 )
163175
176+ if docs_url :
177+ toolkit .print (
178+ f"Documentation at { docs_url } " ,
179+ tag = "server" ,
180+ )
181+
164182 if command == "dev" :
165183 toolkit .print_line ()
166184 toolkit .print (
You can’t perform that action at this time.
0 commit comments