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 @@ -109,6 +109,7 @@ def _run(
109109
110110 module_data = import_data .module_data
111111 import_string = import_data .import_string
112+ fastapi_app = import_data .fastapi_app
112113
113114 toolkit .print (f"Importing from { module_data .extra_sys_path } " )
114115 toolkit .print_line ()
@@ -134,15 +135,32 @@ def _run(
134135 )
135136
136137 url = f"http://{ host } :{ port } "
137- url_docs = f"{ url } /docs"
138+ docs_url = ""
139+
140+ if fastapi_app .openapi_url and (fastapi_app .docs_url or fastapi_app .redoc_url ):
141+ if fastapi_app .docs_url :
142+ docs_url += (
143+ f"[link={ url } { fastapi_app .docs_url } ]{ url } { fastapi_app .docs_url } [/]"
144+ )
145+
146+ if fastapi_app .docs_url and fastapi_app .redoc_url :
147+ docs_url += " or "
148+
149+ if fastapi_app .redoc_url :
150+ docs_url += f"[link={ url } { fastapi_app .redoc_url } ]{ url } { fastapi_app .redoc_url } [/]"
138151
139152 toolkit .print_line ()
140153 toolkit .print (
141154 f"Server started at [link={ url } ]{ url } [/]" ,
142- f"Documentation at [link={ url_docs } ]{ url_docs } [/]" ,
143155 tag = "server" ,
144156 )
145157
158+ if docs_url :
159+ toolkit .print (
160+ f"Documentation at { docs_url } " ,
161+ tag = "server" ,
162+ )
163+
146164 if command == "dev" :
147165 toolkit .print_line ()
148166 toolkit .print (
You can’t perform that action at this time.
0 commit comments