update
This commit is contained in:
parent
6246cc84d5
commit
08ac6ea08c
9
cli.sh
9
cli.sh
|
|
@ -59,8 +59,8 @@ mw_start_debug(){
|
|||
if [ -f ${DIR}/data/port.pl ];then
|
||||
port=$(cat ${DIR}/data/port.pl)
|
||||
fi
|
||||
# gunicorn -b :${port} -k gevent -w 1 app:app
|
||||
cd ${DIR}/web && gunicorn -b :${port} -k eventlet -w 1 app:app
|
||||
cd ${DIR}/web && gunicorn -b :${port} -k eventlet -w 1 app:app
|
||||
# cd ${DIR}/web && gunicorn -b :${port} -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 app:app
|
||||
}
|
||||
|
||||
mw_start_panel(){
|
||||
|
|
@ -68,8 +68,9 @@ mw_start_panel(){
|
|||
if [ -f ${DIR}/data/port.pl ];then
|
||||
port=$(cat ${DIR}/data/port.pl)
|
||||
fi
|
||||
# cd ${DIR}/web && gunicorn -b :${port} -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 app:app
|
||||
cd ${DIR}/web && gunicorn -b :${port} -k eventlet -w 1 app:app
|
||||
# cd ${DIR}/web && gunicorn -b :${port} -k eventlet -w 1 app:app
|
||||
cd ${DIR}/web && gunicorn -b :${port} -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 app:app
|
||||
|
||||
}
|
||||
|
||||
mw_start_bgtask(){
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ import config
|
|||
import utils.config as utils_config
|
||||
import thisdb
|
||||
|
||||
|
||||
# from threading import Lock
|
||||
# thread = None
|
||||
# thread_lock = Lock()
|
||||
|
||||
app = Flask(__name__, template_folder='templates/default')
|
||||
|
||||
|
|
@ -51,7 +53,9 @@ from whitenoise import WhiteNoise
|
|||
app.wsgi_app = WhiteNoise(app.wsgi_app, root="../web/static/", prefix="static/", max_age=604800)
|
||||
|
||||
# session配置
|
||||
app.secret_key = uuid.UUID(int=uuid.getnode()).hex[-12:]
|
||||
# app.secret_key = uuid.UUID(int=uuid.getnode()).hex[-12:]
|
||||
app.config['SECRET_KEY'] = uuid.UUID(int=uuid.getnode()).hex[-12:]
|
||||
|
||||
# app.config['sessions'] = dict()
|
||||
app.config['SESSION_PERMANENT'] = True
|
||||
app.config['SESSION_USE_SIGNER'] = True
|
||||
|
|
|
|||
12
web/app.py
12
web/app.py
|
|
@ -14,6 +14,13 @@ import os
|
|||
from admin import app, socketio
|
||||
import config
|
||||
|
||||
from gevent.pywsgi import WSGIServer
|
||||
from geventwebsocket.handler import WebSocketHandler
|
||||
|
||||
# from gevent import monkey
|
||||
# monkey.patch_all()
|
||||
|
||||
|
||||
if sys.version_info < (3, 6):
|
||||
raise RuntimeError('This application must be run under Python 3.6 or later.')
|
||||
|
||||
|
|
@ -24,6 +31,11 @@ if sys.path[0] != os.path.dirname(os.path.realpath(__file__)):
|
|||
# print(config.DEFAULT_SERVER,config.DEFAULT_SERVER_PORT)
|
||||
# app = create_app()
|
||||
def main():
|
||||
# http_server = WSGIServer(
|
||||
# (HOST, PORT), app, handler_class=WebSocketHandler)
|
||||
# http_server.serve_forever()
|
||||
# socketio.run(app, host=HOST, port=PORT)
|
||||
|
||||
socketio.run(
|
||||
app,
|
||||
debug=config.DEBUG,
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ threads = workers * 1
|
|||
backlog = 512
|
||||
reload = False
|
||||
daemon = True
|
||||
# worker_class = 'geventwebsocket.gunicorn.workers.GeventWebSocketWorker'
|
||||
worker_class = 'eventlet'
|
||||
worker_class = 'geventwebsocket.gunicorn.workers.GeventWebSocketWorker'
|
||||
# worker_class = 'eventlet'
|
||||
timeout = 600
|
||||
keepalive = 60
|
||||
preload_app = True
|
||||
|
|
|
|||
Loading…
Reference in New Issue