nix updates
This commit is contained in:
+3
-2
@@ -9,8 +9,9 @@ buildPythonApplication rec {
|
||||
|
||||
#copy the static files to the output
|
||||
postInstall = ''
|
||||
cp -r static $out/bin/static
|
||||
cp -r templates $out/bin/templates
|
||||
mkdir -p $out/share/ozai-webui
|
||||
cp -r static $out/share/ozai-webui/static
|
||||
cp -r templates $out/share/ozai-webui/templates
|
||||
mv $out/bin/main.py $out/bin/ozai-webui
|
||||
'';
|
||||
}
|
||||
+13
-2
@@ -12,6 +12,8 @@ ozai_url = 'http://localhost:8000/api/'
|
||||
ozai_webui_host = '0.0.0.0'
|
||||
ozai_webui_port = 5000
|
||||
app.config['SECRET_KEY'] = "secret"
|
||||
static_folder = 'static'
|
||||
template_folder = 'templates'
|
||||
|
||||
#check if the environment variables are set
|
||||
if os.getenv('OZAI_URL') is not None:
|
||||
@@ -22,6 +24,10 @@ if os.getenv('OZAI_WEBUI_PORT') is not None:
|
||||
ozai_webui_port = int(os.getenv('OZAI_WEBUI_PORT'))
|
||||
if os.getenv('OZAI_WEBUI_SECRET_KEY') is not None:
|
||||
app.config['SECRET_KEY'] = os.getenv('OZAI_WEBUI_SECRET_KEY')
|
||||
if os.getenv('OZAI_WEBUI_STATIC_FOLDER') is not None:
|
||||
static_folder = os.getenv('STATIC_FOLDER')
|
||||
if os.getenv('OZAI_WEBUI_TEMPLATE_FOLDER') is not None:
|
||||
template_folder = os.getenv('TEMPLATE_FOLDER')
|
||||
|
||||
parser = argparse.ArgumentParser(description="Run the Ozai WebUI server")
|
||||
|
||||
@@ -29,6 +35,9 @@ parser.add_argument('-H', '--host', type=str, default=ozai_webui_host, help='The
|
||||
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()
|
||||
|
||||
@@ -40,8 +49,10 @@ if args.ozai_url:
|
||||
ozai_url = args.ozai_url
|
||||
if args.secret_key:
|
||||
app.config['SECRET_KEY'] = args.secret_key
|
||||
|
||||
|
||||
if args.static_folder:
|
||||
app.static_folder = args.static_folder
|
||||
if args.template_folder:
|
||||
app.template_folder = args.template_folder
|
||||
|
||||
|
||||
#home page
|
||||
|
||||
@@ -11,7 +11,6 @@ requires = (
|
||||
def read(fname):
|
||||
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
||||
|
||||
|
||||
setup(
|
||||
name='ozai-webui',
|
||||
version='0.1.1',
|
||||
|
||||
Reference in New Issue
Block a user