test7
This commit is contained in:
parent
20a26b2a64
commit
0f06a245c1
28
flake.nix
28
flake.nix
@ -32,21 +32,13 @@
|
||||
postInstall = ''
|
||||
mkdir -p $out/share/ozai_webui/static
|
||||
mkdir -p $out/share/ozai_webui/templates
|
||||
mkdir -p $out/lib/python3.11/site-packages/ozai_webui/templates
|
||||
mkdir -p $out/lib/python3.11/site-packages/ozai_webui/static
|
||||
mkdir -p $out/lib/python3.11/site-packages/templates
|
||||
mkdir -p $out/lib/python3.11/site-packages/static
|
||||
mkdir -p $out/lib/python3.11/templates
|
||||
mkdir -p $out/lib/python3.11/static
|
||||
mkdir -p $out/lib/python3.12/site-packages/ozai_webui/templates
|
||||
mkdir -p $out/lib/python3.12/site-packages/ozai_webui/static
|
||||
|
||||
install -Dm444 ${src}/static/* $out/share/ozai_webui/static/
|
||||
install -Dm444 ${src}/templates/* $out/share/ozai_webui/templates/
|
||||
cp -r $src/templates/* $out/lib/python3.11/site-packages/ozai_webui/templates
|
||||
cp -r $src/templates/* $out/lib/python3.11/site-packages/templates
|
||||
cp -r $src/templates/* $out/lib/python3.11/templates
|
||||
cp -r $src/static/* $out/lib/python3.11/site-packages/ozai_webui/static
|
||||
cp -r $src/static/* $out/lib/python3.11/site-packages/static
|
||||
cp -r $src/static/* $out/lib/python3.11/static
|
||||
cp -r $src/templates/* $out/lib/python3.12/site-packages/ozai_webui/templates
|
||||
cp -r $src/static/* $out/lib/python3.12/site-packages/ozai_webui/static
|
||||
'';
|
||||
};
|
||||
|
||||
@ -78,10 +70,10 @@ packages.x86_64-linux.ozai-webui-run = pkgs.stdenv.mkDerivation rec {
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
mkdir -p $out/share/ozai_webui/static
|
||||
mkdir -p $out/share/ozai_webui/templates
|
||||
mkdir -p $out/bin/templates
|
||||
mkdir -p $out/bin/static
|
||||
# mkdir -p $out/share/ozai_webui/static
|
||||
# mkdir -p $out/share/ozai_webui/templates
|
||||
# mkdir -p $out/bin/templates
|
||||
# mkdir -p $out/bin/static
|
||||
cp -r $src/* $out/bin
|
||||
cp $src/run.sh $out/bin/run
|
||||
chmod +x $out/bin/run
|
||||
@ -133,9 +125,9 @@ packages.x86_64-linux.ozai-webui-run = pkgs.stdenv.mkDerivation rec {
|
||||
|
||||
serviceConfig = {
|
||||
#ExecStart = "${self.packages.x86_64-linux.ozai-webui-run}/bin/run ${config.services.ozai-webui.host} ${toString(config.services.ozai-webui.port)} ${self.packages.x86_64-linux.default}/bin";
|
||||
ExecStart = "${self.packages.x86_64-linux.ozai-webui-run}/bin/run ${config.services.ozai-webui.host} ${toString(config.services.ozai-webui.port)} ${self.packages.x86_64-linux.default}/lib/python3.11/site-packages/";
|
||||
# ExecStart = "${self.packages.x86_64-linux.ozai-webui-run}/bin/run ${config.services.ozai-webui.host} ${toString(config.services.ozai-webui.port)} ${self.packages.x86_64-linux.default}/lib/python3.11/site-packages/";
|
||||
# ExecStart = "${self.packages.x86_64-linux.ozai-webui}/bin/ozai-webui";
|
||||
# ExecStart = "${self.packages.x86_64-linux.default}/bin/ozai_webui";
|
||||
ExecStart = "${self.packages.x86_64-linux.default}/bin/ozai_webui --host ${config.services.ozai-webui.host} --port ${toString(config.services.ozai-webui.port)} --ozai_url ${config.services.ozai-webui.ozaiUrl} --static_folder ${self.packages.x86_64-linux.default}/share/ozai-webui/static --template_folder ${self.packages.x86_64-linux.default}/share/ozai-webui/templates";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
|
2
result
2
result
@ -1 +1 @@
|
||||
/nix/store/v6rmds7152d3cg3h77kjsg1kfvmgz108-ozai-webui-run-0.1.1
|
||||
/nix/store/djg747ccyvdlbcpf72617vi92p6vkah5-python3.11-ozai-webui-0.1.1
|
1
result-1
Symbolic link
1
result-1
Symbolic link
@ -0,0 +1 @@
|
||||
/nix/store/jbsrzl3556rkm5amzx1xrjcwwdvry1qk-ozai-webui-run-0.1.1
|
@ -25,29 +25,18 @@ if os.getenv('OZAI_WEBUI_STATIC_FOLDER') is not None:
|
||||
if os.getenv('OZAI_WEBUI_TEMPLATE_FOLDER') is not None:
|
||||
template_folder = os.getenv('OZAI_WEBUI_TEMPLATE_FOLDER')
|
||||
|
||||
|
||||
print(f"using host { ozai_webui_host }")
|
||||
print(f"using port { ozai_webui_port }")
|
||||
print(f"using ozai url { ozai_url }")
|
||||
print(f"using template folder { template_folder }")
|
||||
print(f"using static folder { static_folder }")
|
||||
|
||||
app = Flask(__name__,template_folder=template_folder,static_folder=static_folder )
|
||||
socketio = SocketIO(app)
|
||||
app.config['SECRET_KEY'] = "secret"
|
||||
|
||||
parser = argparse.ArgumentParser(description="Run the Ozai WebUI server")
|
||||
|
||||
parser.add_argument('-H', '--host', type=str, default=ozai_webui_host, help='The host to run the server on')
|
||||
parser.add_argument('-P', '--port', type=int, default=ozai_webui_port, help='The port to run the server on')
|
||||
parser.add_argument('-O', '--ozai_url', type=str, default=ozai_url, help='The URL of the Ozai server')
|
||||
parser.add_argument('-S', '--secret_key', type=str, default=app.config['SECRET_KEY'], help='The secret key for the Flask app')
|
||||
parser.add_argument('--static_folder', type=str, default=static_folder, help='The location of the static folder')
|
||||
parser.add_argument('--template_folder', type=str, default=template_folder, help='The location of the template folder')
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.host:
|
||||
ozai_webui_host = args.host
|
||||
if args.port:
|
||||
@ -61,6 +50,11 @@ if args.static_folder:
|
||||
if args.template_folder:
|
||||
app.template_folder = args.template_folder
|
||||
|
||||
print(f"using host { ozai_webui_host }")
|
||||
print(f"using port { ozai_webui_port }")
|
||||
print(f"using ozai url { ozai_url }")
|
||||
print(f"using template folder { template_folder }")
|
||||
print(f"using static folder { static_folder }")
|
||||
|
||||
#home page
|
||||
@app.route('/')
|
||||
@ -220,9 +214,9 @@ def ws_message(data):
|
||||
socketio.emit('move_status', response.text, room=game_id)
|
||||
|
||||
def main ():
|
||||
app.run(host=ozai_webui_host, port=ozai_webui_port)
|
||||
# return socketio.run(app, debug=False, host=ozai_webui_host, port=ozai_webui_port, allow_unsafe_werkzeug=True)
|
||||
# return socketio.run(app, debug=False, host=ozai_webui_host, port=ozai_webui_port)
|
||||
return socketio.run(app, debug=False, host=ozai_webui_host, port=ozai_webui_port)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
#app.run(host=ozai_webui_host, port=ozai_webui_port)
|
||||
|
Loading…
Reference in New Issue
Block a user