加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
run.py 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
sanjinhub 提交于 2022-06-12 20:43 . v0.5.7
#!/usr/bin/env python
# encoding:utf-8
import gevent.monkey
gevent.monkey.patch_all()
import sys
import platform
def w5_info(**kwargs):
print(" ##@&$||;..!||||||||||;;||||||||%$@##@")
print(" #@$%||||!` .;|||||;. `:!||||||$@@@")
print(" @$%||||||||!` `!||||$@&")
print(" &$||||||||||!. :|||||%$$")
print(" $%||||||||||` `!||||||$$")
print(" $%|||||||||;. :|||||$$")
print(" $%||||||||!. .;|||$$")
print(" &$||||||||; .!|:. `!%$$")
print(" @$%||||||||;. .:|||!' .!&&")
print(" #@$|||||||||||||||!` '%@@")
print(" ##@$%|||||||||||!` :%@#@")
print(" ###@&$||||||||!` !&###@")
print(" #####@&&%||||:. `%&#####@")
print(" ########&&&%: W5 SOAR '$&@#######@ v{version}".format(version="0.5.7"))
print("=============================================")
print("* Web : https://w5.io")
print("* Github : https://github.com/w5hub/w5")
print("=============================================")
if platform.system() == 'Windows':
print("* Running on http://{host}:{port}/ (Press CTRL+C to quit)".format(
host=kwargs["host"],
port=kwargs["port"]
))
def start_w5(**kwargs):
w5_info(host=kwargs["host"], port=kwargs["port"])
if platform.system() == 'Windows':
from core import start
from gevent import pywsgi
from geventwebsocket.handler import WebSocketHandler
server = pywsgi.WSGIServer((kwargs["host"], kwargs["port"]), start, handler_class=WebSocketHandler)
server.serve_forever()
else:
import multiprocessing
from gunicorn.app.wsgiapp import run as start_http
workers = multiprocessing.cpu_count() * 2 + 1
sys.argv.append("-k")
sys.argv.append("flask_sockets.Worker")
sys.argv.append("-b")
sys.argv.append(kwargs["host"] + ":" + str(kwargs["port"]))
sys.argv.append("-w")
sys.argv.append(str(workers))
sys.argv.append("-t")
sys.argv.append("60")
sys.argv.append("--threads")
sys.argv.append("2")
sys.argv.append("core:start")
start_http()
if __name__ == '__main__':
host = '0.0.0.0'
port = 8888
start_w5(host=host, port=port)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化