完善 aiosqlite 异步数据库驱动
This commit is contained in:
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
FROM python:3.9.5
|
FROM python:3.9.5
|
||||||
LABEL author="Lan"
|
LABEL author="Lan"
|
||||||
LABEL email="vast@tom.com"
|
LABEL email="vast@tom.com"
|
||||||
LABEL version="1.0"
|
LABEL version="1.4.2"
|
||||||
|
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||||
RUN echo 'Asia/Shanghai' >/etc/timezone
|
RUN echo 'Asia/Shanghai' >/etc/timezone
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
|
RUN pip install -r requirements.txt
|
||||||
EXPOSE 12345
|
EXPOSE 12345
|
||||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "12345"]
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "12345"]
|
||||||
@@ -9,6 +9,8 @@ engine = create_async_engine("sqlite+aiosqlite:///database.db")
|
|||||||
|
|
||||||
Base = declarative_base()
|
Base = declarative_base()
|
||||||
|
|
||||||
|
Base.metadata.create_all(bind=engine)
|
||||||
|
|
||||||
|
|
||||||
async def get_session():
|
async def get_session():
|
||||||
async with AsyncSession(engine, expire_on_commit=False) as s:
|
async with AsyncSession(engine, expire_on_commit=False) as s:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<meta name="description" content="{{description}}"/>
|
<meta name="description" content="{{description}}"/>
|
||||||
<meta name="keywords" content="{{keywords}}"/>
|
<meta name="keywords" content="{{keywords}}"/>
|
||||||
<meta name="generator" content="FileCodeBox"/>
|
<meta name="generator" content="FileCodeBox"/>
|
||||||
<meta name="template" content="Lan-V1.4.1"/>
|
<meta name="template" content="Lan-V1.4.2"/>
|
||||||
<style>
|
<style>
|
||||||
.qu .el-button {
|
.qu .el-button {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
|
|||||||
Reference in New Issue
Block a user