File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ Run the server using `Uvicorn`:
48
48
uvicorn main:app --reload
49
49
```
50
50
51
+ > You can also run the server by just executing the ` main.py ` file:
52
+ >
53
+ > ``` console
54
+ > python main.py
55
+ > ` ` `
56
+
51
57
Then open your browser at [http://localhost:8000](http://localhost:8000).
52
58
53
59
There is only one endpoint available: `/users`. It returns a list of all users
Original file line number Diff line number Diff line change 1
1
"""An example of using FastAPI with Async SQLAlchemy 2."""
2
- import subprocess
3
2
from contextlib import asynccontextmanager
4
3
4
+ import uvicorn
5
5
from fastapi import Depends , FastAPI
6
6
from sqlalchemy import select
7
7
@@ -42,4 +42,4 @@ async def get_users(session=Depends(get_db)):
42
42
43
43
44
44
if __name__ == "__main__" :
45
- subprocess . call ([ "uvicorn" , " main:app" , "-- reload" ] )
45
+ uvicorn . run ( " main:app" , reload = True )
You can’t perform that action at this time.
0 commit comments