-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.py
37 lines (29 loc) · 843 Bytes
/
dev.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
Runs the application for local development. This file should not be used to start the
application for production.
Refer to https://www.uvicorn.org/deployment/ for production deployments.
"""
from __future__ import annotations
import os
import uvicorn
from rich.console import Console
try:
import uvloop # type: ignore
except ModuleNotFoundError:
pass
else:
uvloop.install()
if __name__ == "__main__":
os.environ["APP_ENV"] = "dev"
port = int(os.environ.get("APP_PORT", 44777))
console = Console()
console.rule("[bold yellow]Running for local development", align="left")
console.print(f"[bold yellow]Visit http://localhost:{port}/docs")
uvicorn.run(
"app.main:app",
host="localhost",
port=port,
lifespan="on",
log_level="info",
reload=True,
)