Initial commit
This commit is contained in:
commit
7d443e57a6
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.venv
|
||||
*.pyc
|
||||
21
database.py
Normal file
21
database.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
SQLITE_DATABASE_URL = "sqlite:///./flosms.db"
|
||||
|
||||
engine = create_engine(
|
||||
SQLITE_DATABASE_URL, echo=True, connect_args={"check_same_thread": False}
|
||||
)
|
||||
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
def get_db():
|
||||
db = SessionLocal()
|
||||
try:
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
3
requirements.txt
Normal file
3
requirements.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fastapi
|
||||
python-dotenv
|
||||
sqlalchemy
|
||||
0
schemas.py
Normal file
0
schemas.py
Normal file
0
service.py
Normal file
0
service.py
Normal file
Loading…
Reference in a new issue