From f4f4e32612ba1b44df4c5e02ce2961d4528c6ddb Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Thu, 28 Nov 2024 00:45:50 +0800 Subject: [PATCH] update --- web/app.py | 30 ++++++++++++------------------ web/config.py | 2 +- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/web/app.py b/web/app.py index 2ef8b0186..d6df771e1 100644 --- a/web/app.py +++ b/web/app.py @@ -12,16 +12,16 @@ import sys import os -# from admin import create_app from admin import app, socketio import config -# from gevent.pywsgi import WSGIServer -# from geventwebsocket.handler import WebSocketHandler +from gevent.pywsgi import WSGIServer +from geventwebsocket.handler import WebSocketHandler from gevent import monkey monkey.patch_all() + # from requests.packages.urllib3.util.ssl_ import create_urllib3_context # create_urllib3_context() @@ -38,21 +38,15 @@ if sys.path[0] != os.path.dirname(os.path.realpath(__file__)): def main(): - # try: - # # 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, - # host=config.DEFAULT_SERVER, - # port=7201, - # ) - # except Exception as e: - # print(str(e)) - - app.run(debug=True) + try: + http_server = WSGIServer( + (HOST, PORT), app, handler_class=WebSocketHandler) + http_server.serve_forever() + socketio.run(app, host=config.DEFAULT_SERVER,debug=config.DEBUG) + except Exception as e: + print(str(e)) + + # app.run(debug=True) if __name__ == '__main__': main() diff --git a/web/config.py b/web/config.py index 60d4b98f2..286d0c517 100644 --- a/web/config.py +++ b/web/config.py @@ -60,7 +60,7 @@ LOG_ROTATION_MAX_LOG_FILES = 5 # 要保留的最大备份数 SQLITE_PATH = os.path.join(DATA_DIR, APP_SQLITE_NAME + '.db') -DEFAULT_SERVER = '127.0.0.1' +DEFAULT_SERVER = '0.0.0.0' DEFAULT_SERVER_PORT = 7201 # APP启动时间