You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Could not import Uvicorn, try running 'pip install uvicorn'"
@@ -97,6 +97,7 @@ def _run(
97
97
workers=workers,
98
98
root_path=root_path,
99
99
proxy_headers=proxy_headers,
100
+
factory=is_factory,
100
101
)
101
102
102
103
@@ -105,7 +106,7 @@ def dev(
105
106
path: Annotated[
106
107
Union[Path, None],
107
108
typer.Argument(
108
-
help="A path to a Python file or package directory (with [blue]__init__.py[/blue] files) containing a [bold]FastAPI[/bold] app. If not provided, a default set of paths will be tried."
109
+
help="A path to a Python file or package directory (with [blue]__init__.py[/blue] files) containing a [bold]FastAPI[/bold] app or app factory. If not provided, a default set of paths will be tried."
109
110
),
110
111
] =None,
111
112
*,
@@ -145,6 +146,10 @@ def dev(
145
146
help="Enable/Disable X-Forwarded-Proto, X-Forwarded-For, X-Forwarded-Port to populate remote address info."
146
147
),
147
148
] =True,
149
+
factory: Annotated[
150
+
bool,
151
+
typer.Option(help="Treat [bold]path[bold] as an application factory, i.e. a () -> <ASGI app> callable.")
152
+
] =False,
148
153
) ->Any:
149
154
"""
150
155
Run a [bold]FastAPI[/bold] app in [yellow]development[/yellow] mode. 🧪
@@ -180,6 +185,7 @@ def dev(
180
185
app=app,
181
186
command="dev",
182
187
proxy_headers=proxy_headers,
188
+
is_factory=factory,
183
189
)
184
190
185
191
@@ -234,6 +240,10 @@ def run(
234
240
help="Enable/Disable X-Forwarded-Proto, X-Forwarded-For, X-Forwarded-Port to populate remote address info."
235
241
),
236
242
] =True,
243
+
factory: Annotated[
244
+
bool,
245
+
typer.Option(help="Treat [bold]path[bold] as an application factory, i.e. a () -> <ASGI app> callable.")
246
+
] =False,
237
247
) ->Any:
238
248
"""
239
249
Run a [bold]FastAPI[/bold] app in [green]production[/green] mode. 🚀
0 commit comments