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`:
4848uvicorn main:app --reload
4949```
5050
51+ > You can also run the server by just executing the ` main.py ` file:
52+ >
53+ > ``` console
54+ > python main.py
55+ > ` ` `
56+
5157Then open your browser at [http://localhost:8000](http://localhost:8000).
5258
5359There is only one endpoint available: `/users`. It returns a list of all users
Original file line number Diff line number Diff line change 11"""An example of using FastAPI with Async SQLAlchemy 2."""
2- import subprocess
32from contextlib import asynccontextmanager
43
4+ import uvicorn
55from fastapi import Depends , FastAPI
66from sqlalchemy import select
77
@@ -42,4 +42,4 @@ async def get_users(session=Depends(get_db)):
4242
4343
4444if __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