Skip to content

Commit 5efe2dd

Browse files
authored
Merge pull request #3 from dmsnback/feature/models
omg
2 parents 11afe00 + 90f91a2 commit 5efe2dd

6 files changed

Lines changed: 23 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# world_flow
1+
# word_flow
22
API тренировки английского и Telegram бот

app/core/base.py

Whitespace-only changes.

app/core/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class Settings(BaseSettings):
55
app_title: str
66
description: str
77
database_url: str
8+
debug: bool
89

910
model_config = {"env_file": ".env", "extra": "ignore"}
1011

app/core/database.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
2+
from sqlalchemy.orm import DeclarativeBase
3+
4+
from app.core.config import settings
5+
6+
engine = create_async_engine(
7+
settings.database_url, echo=settings.debug, future=True
8+
)
9+
10+
async_session = async_sessionmaker(engine, expire_on_commit=False)
11+
12+
13+
class Base(DeclarativeBase):
14+
pass
15+
16+
17+
async def get_session():
18+
async with async_session() as session:
19+
yield session

app/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
@asynccontextmanager
1515
async def lifespan(app: FastAPI):
16-
logging.info("Приложение World Flow запущено")
16+
logging.info("Приложение Word Flow запущено")
1717
yield
18-
logging.info("Приложение World Flow остановлено")
18+
logging.info("Приложение Word Flow остановлено")
1919

2020

2121
app = FastAPI(

app/models/words.py

Whitespace-only changes.

0 commit comments

Comments
 (0)