Archived
小修改
This commit is contained in:
4 files changed
+22
-14
No files matched your search
+8
-7
@@ -14,19 +14,20 @@ from ..decorators import time_it
|
|||||||
|
|
||||||
@time_it
|
@time_it
|
||||||
def download():
|
def download():
|
||||||
res = requests.get('https://markusjoe.github.io/static_file_hosting/data.sqlite')
|
res = requests.get('https://filebase.vercel.app/download/data.db')
|
||||||
with open('./app/db/data.sqlite', 'wb') as fp:
|
with open('./app/db/data.sqlite', 'wb') as fp:
|
||||||
fp.write(res.content)
|
fp.write(res.content)
|
||||||
|
|
||||||
|
|
||||||
if __name__ != '__main__':
|
if not os.path.exists('./app/db/data.sqlite'):
|
||||||
if not os.path.exists('./app/db/data.sqlite'):
|
print('C: 数据库文件未找到, 正在下载中')
|
||||||
print('数据库文件未找到, 正在下载中')
|
|
||||||
try:
|
try:
|
||||||
download()
|
download()
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print('下载失败, 错误原因:', error)
|
print('C: 下载失败, 错误原因:', error)
|
||||||
print('请手动下载数据库文件到 ./app/db/data.sqlite')
|
print('I: 请手动下载数据库文件到 ./app/db/data.sqlite')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
__all__ = ['db']
|
__all__ = [
|
||||||
|
'db'
|
||||||
|
]
|
||||||
@@ -7,3 +7,7 @@
|
|||||||
|
|
||||||
|
|
||||||
print('Tests models were loaded.')
|
print('Tests models were loaded.')
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
|
||||||
|
]
|
||||||
@@ -5,3 +5,6 @@
|
|||||||
# @Create Time: 2022/3/25
|
# @Create Time: 2022/3/25
|
||||||
# @File Name: __init__.py.py
|
# @File Name: __init__.py.py
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
'view'
|
||||||
|
]
|
||||||
@@ -13,11 +13,11 @@ app = create_app('default')
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
from gevent import pywsgi
|
from gevent import pywsgi
|
||||||
|
|
||||||
print('服务运行在 http://127.0.0.1:5000')
|
print('I: 服务运行在 http://127.0.0.1:5000')
|
||||||
try:
|
try:
|
||||||
server = pywsgi.WSGIServer(('0.0.0.0', 5000), app)
|
server = pywsgi.WSGIServer(('0.0.0.0', 5000), app)
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('已退出')
|
print('I: 已退出')
|
||||||
except OSError:
|
except OSError:
|
||||||
print('5000 端口已被占用')
|
print('C: 5000 端口已被占用')
|
||||||
Reference in New Issue
Block a user