运行配置

This commit is contained in:
lhx
2025-09-27 10:46:09 +08:00
parent dff6c8cd91
commit 7a635eb414
6 changed files with 57 additions and 5 deletions

BIN
cloud-bin-amd64/uv Normal file

Binary file not shown.

BIN
cloud-bin-amd64/uvx Normal file

Binary file not shown.

24
pyproject.toml Normal file
View File

@@ -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

29
setup.sh Normal file
View File

@@ -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

View File

@@ -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"

View File

@@ -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
}