diff --git a/cloud-bin-amd64/uv b/cloud-bin-amd64/uv new file mode 100644 index 0000000..92238b2 Binary files /dev/null and b/cloud-bin-amd64/uv differ diff --git a/cloud-bin-amd64/uvx b/cloud-bin-amd64/uvx new file mode 100644 index 0000000..511dc7f Binary files /dev/null and b/cloud-bin-amd64/uvx differ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..136adba --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,24 @@ +[project] +name = "tielu-railway-management" +version = "1.0.0" +description = "Railway Project Management System" +readme = "README.md" +requires-python = ">=3.11" +dependencies = [ + "fastapi>=0.104.1", + "uvicorn>=0.24.0", + "sqlalchemy>=2.0.23", + "pymysql>=1.1.0", + "cryptography>=41.0.7", + "pydantic>=2.5.0", + "python-dotenv>=1.0.0", + "apscheduler>=3.10.4", + "pandas>=2.1.3", + "python-multipart>=0.0.6", + "openpyxl>=3.1.5", +] + +[tool.uv.index] +url = "https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple" +python-install-mirror = "https://mirror.nju.edu.cn/github-release/indygreg/python-build-standalone" +default = true diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..0e4d1e0 --- /dev/null +++ b/setup.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# 注意:此脚本应在 WSL 或 Linux 环境中运行 + +# 提示用户输入密码 +read -s -p "请输入sudo密码: " sudo_password +echo "" + +# 定义一个函数来执行需要sudo的命令 +run_with_sudo() { + echo "$sudo_password" | sudo -S bash -c "$1" +} + +# 安装unzip +run_with_sudo "apt update" + +# 给本地工具添加执行权限 +chmod +x ./cloud-bin-amd64/uv + +# 临时将本地工具目录添加到PATH +export PATH="$(pwd)/cloud-bin-amd64:$PATH" + +# 配置pip源并使用 uv 安装Python依赖 +echo "正在配置 PyPI 源并同步依赖..." +uv sync +uv pip install -r pyproject.toml +if [ ! -d ".venv" ]; then + echo "没有找到有虚拟环境" +fi +# source .venv/bin/activate diff --git a/start_daemon.sh b/start_daemon.sh index 555598c..d9a8512 100644 --- a/start_daemon.sh +++ b/start_daemon.sh @@ -5,7 +5,7 @@ # 默认端口: 8000 # 设置端口号,默认为8000 -PORT=${1:-8000} +PORT=${1:-3002} # 设置日志文件路径 LOG_DIR="logs" @@ -16,12 +16,12 @@ PID_FILE="$LOG_DIR/app.pid" # 临时添加.venv/bin到PATH export PATH=$PATH:$(pwd)/.venv/bin +# 临时添加./cloud-bin-amd64/到PATH +export PATH=$PATH:$(pwd)/cloud-bin-amd64 # 激活虚拟环境 source .venv/bin/activate -pip install -r requirements.txt - # 创建日志目录 mkdir -p "$LOG_DIR" diff --git a/start_server.sh b/start_server.sh index cdc2628..967169a 100644 --- a/start_server.sh +++ b/start_server.sh @@ -5,7 +5,7 @@ # 默认端口: 8000 # 设置端口号,默认为8000 -PORT=${1:-8000} +PORT=${1:-3002} echo "=== 铁路项目管理系统启动脚本 ===" echo "端口: $PORT" @@ -66,7 +66,6 @@ check_dependencies() { python3 -c "import fastapi, uvicorn" 2>/dev/null if [ $? -ne 0 ]; then echo "错误: 缺少必要的依赖包 (fastapi, uvicorn)" - echo "请运行: pip install -r requirements.txt" exit 1 fi }