From 88a0b1975f1f05bbed1ca1d6927953a3eb24f5fe Mon Sep 17 00:00:00 2001 From: RTAkland Date: Thu, 22 Dec 2022 19:12:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/view.py | 3 +++ src/config.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/view.py b/src/api/view.py index e23e804..36e67fe 100644 --- a/src/api/view.py +++ b/src/api/view.py @@ -6,6 +6,7 @@ # @File Name: view.py +import os import time from src.api import api from src.db import Database @@ -52,6 +53,8 @@ async def query_all(limit: int = 30): @api.get('/export') async def export(): + if os.path.exists('/tmp/data.sqlite'): + return FileResponse('/tmp/data.sqlite') return FileResponse('./src/db/data.sqlite') diff --git a/src/config.py b/src/config.py index 311c225..46ab4ee 100644 --- a/src/config.py +++ b/src/config.py @@ -13,5 +13,5 @@ class Config: sqlite3 -> sqlite3 (default) mysql -> user:pwd@host:port/db """ - database = os.getenv('COUNTER_DB') or "sqlite3" # Database type + database = os.getenv('COUNTER_DB') or "root:123@gd.dgtmc.top:3306/" # Database type DETA = False if not os.getenv('DETA_RUNTIME') else True # mark deta