Archived
fix: 修复导出文件的bug
This commit is contained in:
2 files changed
+4
-1
No files matched your search
@@ -6,6 +6,7 @@
|
|||||||
# @File Name: view.py
|
# @File Name: view.py
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
from src.api import api
|
from src.api import api
|
||||||
from src.db import Database
|
from src.db import Database
|
||||||
@@ -52,6 +53,8 @@ async def query_all(limit: int = 30):
|
|||||||
|
|
||||||
@api.get('/export')
|
@api.get('/export')
|
||||||
async def export():
|
async def export():
|
||||||
|
if os.path.exists('/tmp/data.sqlite'):
|
||||||
|
return FileResponse('/tmp/data.sqlite')
|
||||||
return FileResponse('./src/db/data.sqlite')
|
return FileResponse('./src/db/data.sqlite')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -13,5 +13,5 @@ class Config:
|
|||||||
sqlite3 -> sqlite3 (default)
|
sqlite3 -> sqlite3 (default)
|
||||||
mysql -> user:pwd@host:port/db
|
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
|
DETA = False if not os.getenv('DETA_RUNTIME') else True # mark deta
|
||||||
Reference in New Issue
Block a user