增加web_api
This commit is contained in:
55
build_exe.sh
Normal file
55
build_exe.sh
Normal file
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
# GasFlux Web API - Build executable with PyInstaller
|
||||
# This script builds a standalone executable using Waitress WSGI server
|
||||
|
||||
echo "Building GasFlux Web API executable..."
|
||||
|
||||
# Check if PyInstaller is installed
|
||||
if ! python3 -c "import PyInstaller" 2>/dev/null; then
|
||||
echo "Error: PyInstaller is not installed. Please run:"
|
||||
echo "pip install pyinstaller waitress"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if Waitress is installed
|
||||
if ! python3 -c "import waitress" 2>/dev/null; then
|
||||
echo "Error: Waitress is not installed. Please run:"
|
||||
echo "pip install waitress"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create dist directory if it doesn't exist
|
||||
mkdir -p dist
|
||||
|
||||
echo "Creating executable with PyInstaller..."
|
||||
|
||||
# Build the executable
|
||||
pyinstaller --onefile \
|
||||
--name GasFluxAPI \
|
||||
--hidden-import waitress \
|
||||
--hidden-import flask \
|
||||
--hidden-import werkzeug \
|
||||
--hidden-import yaml \
|
||||
--hidden-import pandas \
|
||||
--hidden-import numpy \
|
||||
--hidden-import flask_cors \
|
||||
--hidden-import psutil \
|
||||
--add-data "src/gasflux/gasflux_config.yaml:src/gasflux" \
|
||||
--add-data "API_DOCUMENTATION.md:." \
|
||||
--exclude-module matplotlib \
|
||||
--exclude-module tkinter \
|
||||
server_waitress.py
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to build executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Build completed successfully!"
|
||||
echo "Executable created: dist/GasFluxAPI"
|
||||
echo ""
|
||||
echo "To run the server:"
|
||||
echo "./dist/GasFluxAPI"
|
||||
echo ""
|
||||
echo "The server will start on http://localhost:5000"
|
||||
Reference in New Issue
Block a user