2018-10-25 04:40:45 -04:00
|
|
|
# coding:utf-8
|
|
|
|
|
|
2022-11-14 03:36:39 -05:00
|
|
|
# ---------------------------------------------------------------------------------
|
|
|
|
|
# MW-Linux面板
|
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
|
|
|
# copyright (c) 2018-∞(https://github.com/midoks/mdserver-web) All rights reserved.
|
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
|
|
|
# Author: midoks <midoks@163.com>
|
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
|
|
|
# 入口文件
|
|
|
|
|
# ---------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
2022-07-01 06:18:08 -04:00
|
|
|
# pip install profiler_online
|
|
|
|
|
# 性能测试
|
|
|
|
|
# from profiler_online import run_profiler
|
|
|
|
|
# run_profiler()
|
2018-10-02 09:50:10 -04:00
|
|
|
import sys
|
|
|
|
|
import io
|
|
|
|
|
import os
|
2023-01-15 13:04:12 -05:00
|
|
|
|
|
|
|
|
sys.dont_write_bytecode = True
|
2019-02-18 03:21:31 -05:00
|
|
|
from route import app, socketio
|
2018-10-14 05:37:43 -04:00
|
|
|
|
2021-12-04 22:29:12 -05:00
|
|
|
|
2021-11-08 05:31:00 -05:00
|
|
|
from gevent.pywsgi import WSGIServer
|
|
|
|
|
from geventwebsocket.handler import WebSocketHandler
|
|
|
|
|
|
2023-06-28 22:18:52 -04:00
|
|
|
|
2023-06-28 22:25:14 -04:00
|
|
|
from gevent import monkey
|
|
|
|
|
monkey.patch_all()
|
2022-11-14 03:36:39 -05:00
|
|
|
|
2018-10-26 01:53:39 -04:00
|
|
|
try:
|
|
|
|
|
if __name__ == "__main__":
|
2022-06-26 11:25:27 -04:00
|
|
|
|
|
|
|
|
PORT = 7200
|
|
|
|
|
if os.path.exists('data/port.pl'):
|
|
|
|
|
f = open('data/port.pl')
|
|
|
|
|
PORT = int(f.read())
|
|
|
|
|
f.close()
|
|
|
|
|
|
2023-01-22 15:06:43 -05:00
|
|
|
# HOST = '0.0.0.0'
|
|
|
|
|
# app.run(host=HOST, port=PORT)
|
|
|
|
|
|
2021-11-08 05:31:00 -05:00
|
|
|
http_server = WSGIServer(
|
|
|
|
|
(HOST, PORT), app, handler_class=WebSocketHandler)
|
|
|
|
|
http_server.serve_forever()
|
2019-02-18 03:21:31 -05:00
|
|
|
socketio.run(app, host=HOST, port=PORT)
|
2018-10-26 01:53:39 -04:00
|
|
|
except Exception as ex:
|
2021-04-30 23:31:51 -04:00
|
|
|
print(ex)
|