This repository has been archived on 2026-08-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
RequestCounter/manage.py
T

30 lines
684 B
Python
Raw Normal View History

2022-03-26 08:02:25 +08:00
#!/usr/bin/env python3
# -- coding:utf-8 --
# @Author: markushammered@gmail.com
# @Development Tool: PyCharm
# @Create Time: 2022/3/25
# @File Name: manage.py
2022-03-26 09:12:12 +08:00
import os
import requests
2022-03-26 08:02:25 +08:00
from gevent import pywsgi
from app import create_app
app = create_app()
2022-03-26 09:12:12 +08:00
def download():
res = requests.get('http://resource-base.herokuapp.com/download/data.db')
with open('./app/db/data.db', 'wb') as fp:
fp.write(res.content)
if not os.path.exists('./app/db/data.db'):
print('数据库文件未找到, 正在下载中')
download()
print('下载完成')
2022-03-26 08:02:25 +08:00
if __name__ == '__main__':
2022-03-26 08:41:57 +08:00
server = pywsgi.WSGIServer(('0.0.0.0', 5000), app)
2022-03-26 08:41:47 +08:00
server.serve_forever()