Archived
更新
This commit is contained in:
4 files changed
+61
-27
No files matched your search
@@ -6,25 +6,17 @@
|
||||
# @File Name: manage.py
|
||||
|
||||
|
||||
import os
|
||||
import requests
|
||||
from gevent import pywsgi
|
||||
from app import create_app
|
||||
|
||||
app = create_app()
|
||||
|
||||
|
||||
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('下载完成')
|
||||
app = create_app('default')
|
||||
|
||||
if __name__ == '__main__':
|
||||
server = pywsgi.WSGIServer(('0.0.0.0', 5000), app)
|
||||
server.serve_forever()
|
||||
print('服务运行在 http://127.0.0.1:5000')
|
||||
try:
|
||||
server = pywsgi.WSGIServer(('0.0.0.0', 5000), app)
|
||||
server.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print('已退出')
|
||||
except OSError:
|
||||
print('5000 端口已被占用')
|
||||
Reference in New Issue
Block a user