File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ DEBUG=True
33PROJECT_NAME = " My app"
44VERSION = " 1.0.0"
55
6- DATABASE_URL = " postgresql+asyncpg://postgres:postgres@localhost:5432/valory"
6+ DATABASE_URL = " postgresql+asyncpg://postgres:postgres@localhost:5432/valory"
7+ DEGUB_DATABASE_URL = " sqlite+aiosqlite:///sqlite.db"
Original file line number Diff line number Diff line change 33from sqlmodel import SQLModel
44from app import settings
55
6- engine = create_async_engine (settings .DATABASE_URL , echo = True , future = True )
6+ if settings .DEBUG :
7+ engine = create_async_engine (settings .DEGUB_DATABASE_URL , echo = True , future = True )
8+ else :
9+ engine = create_async_engine (settings .DATABASE_URL , echo = True , future = True )
710
811AsyncSessionLocal = sessionmaker (
912 bind = engine ,
Original file line number Diff line number Diff line change @@ -20,4 +20,5 @@ def str_to_bool(value: str) -> bool:
2020PROJECT_NAME = environ .get ('PROJECT_NAME' )
2121VERSION = environ .get ('VERSION' )
2222
23- DATABASE_URL = environ .get ('DATABASE_URL' )
23+ DATABASE_URL = environ .get ('DATABASE_URL' )
24+ DEGUB_DATABASE_URL = environ .get ('DEGUB_DATABASE_URL' )
Original file line number Diff line number Diff line change @@ -30,8 +30,7 @@ async def lifespan(app: FastAPI):
3030 allow_headers = ["*" ],
3131)
3232
33- app .include_router (api_router , prefix = "/api/v1 " )
33+ app .include_router (api_router , prefix = "/api/" )
3434
35- @app .get ("/" )
36- async def read_root ():
37- return {"message" : "Welcome to the API!" }
35+ if __name__ == "__main__" :
36+ uvicorn .run (app = "main:app" , reload = True )
You can’t perform that action at this time.
0 commit comments