Ajouter Dockerfile, requirements.txt, et mettre à jour les imports dans models.py et security.py
This commit is contained in:
parent
26020ecbc1
commit
c6579868d7
4 changed files with 41 additions and 6 deletions
11
Dockerfile
Normal file
11
Dockerfile
Normal file
|
@ -0,0 +1,11 @@
|
|||
FROM python:3.12-bookworm
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./requirements.txt /app/requirements.txt
|
||||
|
||||
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
||||
|
||||
COPY . /app
|
||||
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
|
|
@ -61,7 +61,7 @@ SQLITE_FILE_NAME = "database.db"
|
|||
DATABASE_URL = f"sqlite:///{SQLITE_FILE_NAME}"
|
||||
|
||||
connect_args = {"check_same_thread": False}
|
||||
engine = create_engine(DATABASE_URL, echo=True, connect_args=connect_args)
|
||||
engine = create_engine(DATABASE_URL, connect_args=connect_args)
|
||||
|
||||
|
||||
def create_db_and_tables():
|
||||
|
|
26
requirements.txt
Normal file
26
requirements.txt
Normal file
|
@ -0,0 +1,26 @@
|
|||
annotated-types==0.6.0
|
||||
anyio==4.3.0
|
||||
argon2-cffi==23.1.0
|
||||
argon2-cffi-bindings==21.2.0
|
||||
cffi==1.16.0
|
||||
click==8.1.7
|
||||
fastapi==0.110.1
|
||||
greenlet==3.0.3
|
||||
h11==0.14.0
|
||||
httptools==0.6.1
|
||||
idna==3.7
|
||||
passlib==1.7.4
|
||||
pycparser==2.22
|
||||
pydantic==2.6.4
|
||||
pydantic_core==2.16.3
|
||||
python-dotenv==1.0.1
|
||||
PyYAML==6.0.1
|
||||
sniffio==1.3.1
|
||||
SQLAlchemy==2.0.29
|
||||
sqlmodel==0.0.16
|
||||
starlette==0.37.2
|
||||
typing_extensions==4.11.0
|
||||
uvicorn==0.29.0
|
||||
uvloop==0.19.0
|
||||
watchfiles==0.21.0
|
||||
websockets==12.0
|
|
@ -1,11 +1,9 @@
|
|||
from passlib.context import CryptContext
|
||||
|
||||
pwd_context = CryptContext(schemes=["argon2"])
|
||||
from passlib.hash import argon2
|
||||
|
||||
|
||||
def hash_password(password: str | bytes):
|
||||
return pwd_context.hash(password)
|
||||
return argon2.hash(password)
|
||||
|
||||
|
||||
def verify_password(password: str | bytes, hashed_password: str):
|
||||
return pwd_context.verify(password, hashed_password)
|
||||
return argon2.verify(password, hashed_password)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue