Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# world_flow
# word_flow
API тренировки английского и Telegram бот
Empty file added app/core/base.py
Empty file.
1 change: 1 addition & 0 deletions app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Settings(BaseSettings):
app_title: str
description: str
database_url: str
debug: bool

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

Expand Down
19 changes: 19 additions & 0 deletions app/core/database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from sqlalchemy.orm import DeclarativeBase

from app.core.config import settings

engine = create_async_engine(
settings.database_url, echo=settings.debug, future=True
)

async_session = async_sessionmaker(engine, expire_on_commit=False)


class Base(DeclarativeBase):
pass


async def get_session():
async with async_session() as session:
yield session
4 changes: 2 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

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


app = FastAPI(
Expand Down
Empty file added app/models/words.py
Empty file.