This commit is contained in:
cjw
2026-02-13 00:29:12 +08:00
parent 09e586734b
commit aa1c91b818
7 changed files with 43 additions and 20 deletions
+10 -1
View File
@@ -1,6 +1,15 @@
# 服务配置 # 服务配置
HOST=0.0.0.0 HOST=0.0.0.0
PORT=8000
# ================================
# 端口配置 - 唯一修改端口的地方
# ================================
# 应用端口(容器内端口)
PORT=10003
# Docker映射到宿主机的端口(docker-compose使用)
HOST_PORT=10001
# ================================
DEBUG=false DEBUG=false
# 文件处理配置 # 文件处理配置
+13 -4
View File
@@ -1,9 +1,18 @@
# 服务器配置 # 服务配置
HOST=0.0.0.0 HOST=0.0.0.0
# ================================
# 端口配置 - 唯一修改端口的地方
# ================================
# 应用端口(容器内端口)
PORT=8000 PORT=8000
# Docker映射到宿主机的端口(docker-compose使用)
HOST_PORT=10001
# ================================
DEBUG=false DEBUG=false
# 文件上传配置 # 文件处理配置
UPLOAD_DIR=./uploads UPLOAD_DIR=./uploads
MAX_FILE_SIZE=104857600 MAX_FILE_SIZE=104857600
ALLOWED_EXTENSIONS=.stp,.step,.stp.gz ALLOWED_EXTENSIONS=.stp,.step,.stp.gz
@@ -13,12 +22,12 @@ POINTCLOUD_SAMPLE_COUNT=10000
MESH_QUALITY=high MESH_QUALITY=high
PARALLEL_PROCESSING=true PARALLEL_PROCESSING=true
# PostgreSQL 数据库配置 # 数据库配置
DB_HOST=localhost DB_HOST=localhost
DB_PORT=5432 DB_PORT=5432
DB_NAME=moldinsight DB_NAME=moldinsight
DB_USER=moldinsight_user DB_USER=moldinsight_user
DB_PASSWORD=your_secure_password_here DB_PASSWORD=moldinsight_password
# RustFS 对象存储配置 (S3v4 API) # RustFS 对象存储配置 (S3v4 API)
RUSTFS_ENDPOINT=http://localhost:9000 RUSTFS_ENDPOINT=http://localhost:9000
+5 -1
View File
@@ -63,6 +63,7 @@ moldinsight_project/
pip install -r requirements.txt pip install -r requirements.txt
``` ```
2. 配置数据库连接(修改.env文件) 2. 配置数据库连接(修改.env文件)
3. 启动服务: 3. 启动服务:
@@ -70,4 +71,7 @@ pip install -r requirements.txt
python src/main.py python src/main.py
``` ```
4. 访问 http://localhost:8000 4. 访问服务
- 查看端口配置:打开 `.env` 文件查看 `PORT` 的值
- 默认端口:8000
- 访问地址:http://localhost:${PORT}
+4 -3
View File
@@ -45,15 +45,16 @@ services:
build: . build: .
container_name: moldinsight_app container_name: moldinsight_app
ports: ports:
- "10001:8000" # 宿主机端口:容器端口 - "${HOST_PORT:-10001}:${CONTAINER_PORT:-8000}" # 宿主机端口:容器端口
volumes: volumes:
- ./uploads:/app/uploads - ./uploads:/app/uploads
- ./html_output:/app/html_output - ./html_output:/app/html_output
- ./logs:/app/logs - ./logs:/app/logs
- ./.env:/app/.env:ro - ./.env:/app/.env:ro
environment: environment:
# 应用内部使用8000端口(容器内) # 应用端口配置(从settings.py读取)
- PORT=8000 - HOST=${HOST:-0.0.0.0}
- PORT=${CONTAINER_PORT:-8000}
# 数据库配置 # 数据库配置
- DB_HOST=postgres - DB_HOST=postgres
- DB_PORT=5432 - DB_PORT=5432
+7 -9
View File
@@ -111,24 +111,22 @@ async def health():
if __name__ == "__main__": if __name__ == "__main__":
import uvicorn import uvicorn
import os
# 从配置文件获取端口配置
# 直接从环境变量获取端口,避免配置导入问题 from config.settings import settings
host = os.getenv('HOST', '0.0.0.0')
port = int(os.getenv('PORT', '8000'))
print("启动模具几何分析服务 v3.0...") print("启动模具几何分析服务 v3.0...")
print(f"访问 http://localhost:{port} 使用网页界面") print(f"访问 http://localhost:{settings.PORT} 使用网页界面")
print("新增功能:") print("新增功能:")
print(" - STP文件解析为JSON数据") print(" - STP文件解析为JSON数据")
print(" - 数据存储到PostgreSQL数据库") print(" - 数据存储到PostgreSQL数据库")
print(" - 自动生成3D可视化HTML页面") print(" - 自动生成3D可视化HTML页面")
print(" - 源文件、JSON数据、HTML文件统一管理") print(" - 源文件、JSON数据、HTML文件统一管理")
print(f"调试接口: http://localhost:{port}/debug/tasks") print(f"调试接口: http://localhost:{settings.PORT}/debug/tasks")
uvicorn.run( uvicorn.run(
"main:app", "main:app",
host=host, host=settings.HOST,
port=port, port=settings.PORT,
reload=True reload=True
) )
+2 -1
View File
@@ -49,7 +49,8 @@ echo "🔧 检查数据库连接..."
# 启动服务 # 启动服务
echo "🚀 启动 MoldInsight 服务..." echo "🚀 启动 MoldInsight 服务..."
echo "🌐 服务将在 http://localhost:8000 启动" PORT=$(grep '^PORT=' .env 2>/dev/null | cut -d'=' -f2 || echo '8000')
echo "🌐 服务将在 http://localhost:${PORT} 启动"
echo "📊 功能特性:" echo "📊 功能特性:"
echo " - STP文件解析和几何分析" echo " - STP文件解析和几何分析"
echo " - JSON数据导出" echo " - JSON数据导出"
+2 -1
View File
@@ -49,7 +49,8 @@ echo "🔧 检查数据库连接..."
# 启动服务 # 启动服务
echo "🚀 启动 MoldInsight 服务..." echo "🚀 启动 MoldInsight 服务..."
echo "🌐 服务将在 http://localhost:8000 启动" PORT=$(grep '^PORT=' .env 2>/dev/null | cut -d'=' -f2 || echo '8000')
echo "🌐 服务将在 http://localhost:${PORT} 启动"
echo "📊 功能特性:" echo "📊 功能特性:"
echo " - STP文件解析和几何分析" echo " - STP文件解析和几何分析"
echo " - JSON数据导出" echo " - JSON数据导出"