From b999073da456d3c847224190782dec9e73dd7828 Mon Sep 17 00:00:00 2001 From: lan-air Date: Sun, 11 Dec 2022 18:03:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20aiosqlite=20=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E6=95=B0=E6=8D=AE=E5=BA=93=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- database.py | 2 ++ templates/index.html | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6b4c6f8..54956d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ FROM python:3.9.5 LABEL author="Lan" LABEL email="vast@tom.com" -LABEL version="1.0" +LABEL version="1.4.2" COPY . /app RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN echo 'Asia/Shanghai' >/etc/timezone WORKDIR /app -RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/ +RUN pip install -r requirements.txt EXPOSE 12345 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "12345"] \ No newline at end of file diff --git a/database.py b/database.py index 074319b..5770694 100644 --- a/database.py +++ b/database.py @@ -9,6 +9,8 @@ engine = create_async_engine("sqlite+aiosqlite:///database.db") Base = declarative_base() +Base.metadata.create_all(bind=engine) + async def get_session(): async with AsyncSession(engine, expire_on_commit=False) as s: diff --git a/templates/index.html b/templates/index.html index 21e0881..352453e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -10,7 +10,7 @@ - +