fix: 支持原文件下载,同时将postgres地址由localhost变更为8.152.207.171

This commit is contained in:
sophie committed 2026-04-03 11:30:49 +08:00
1 parent 70f95e9f5c
commit c380248502
12 files changed
+1273 -273

No files matched your search

+27 -10
View File
@@ -1,9 +1,17 @@
"""
"""
backend/app/config.py
配置类,区分开发/生产环境
"""
import os
from pathlib import Path
from dotenv import load_dotenv
# Auto-load backend/.env so new shell windows also pick up local settings.
_BACKEND_DIR = Path(__file__).resolve().parents[1]
load_dotenv(_BACKEND_DIR / '.env')
class Config:
SQLALCHEMY_TRACK_MODIFICATIONS = False
@@ -13,7 +21,7 @@ class Config:
'pool_size': 20,
'max_overflow': 10,
'pool_recycle': 3600,
'pool_pre_ping': True
'pool_pre_ping': True,
}
# Dify 网关配置
DIFY_API_BASE = os.getenv('DIFY_API_BASE', 'https://api.dify.ai/v1')
@@ -23,10 +31,15 @@ class Config:
FEEDBACK_ENABLED = os.getenv('FEEDBACK_ENABLED', 'true').lower() == 'true'
HR_WORKFLOW_IFRAME_URL = os.getenv(
'HR_WORKFLOW_IFRAME_URL',
'http://192.168.100.230:8882/chatbot/imrmbYyasJUHjXQg'
'http://192.168.100.230:8882/chatbot/imrmbYyasJUHjXQg',
)
HR_WORKFLOW_API_BASE = os.getenv('HR_WORKFLOW_API_BASE', 'http://127.0.0.1:5001/v1')
HR_WORKFLOW_API_KEY = os.getenv('HR_WORKFLOW_API_KEY')
# External integration API (resolve original source file links by Dify IDs)
INTEGRATION_API_BASE = os.getenv('INTEGRATION_API_BASE', 'http://192.168.100.230:8891')
INTEGRATION_API_KEY = os.getenv('INTEGRATION_API_KEY')
# WeCom (企业微信) 登录配置
WECOM_ENABLED = os.getenv('WECOM_ENABLED', 'false').lower() == 'true'
WECOM_CORP_ID = os.getenv('WECOM_CORP_ID')
@@ -35,19 +48,22 @@ class Config:
WECOM_REDIRECT_URI = os.getenv('WECOM_REDIRECT_URI')
WECOM_AUTO_CREATE_USER = os.getenv('WECOM_AUTO_CREATE_USER', 'true').lower() == 'true'
class DevelopmentConfig(Config):
DEBUG = True
# 本地 MacBook PostgreSQL 配置(数据库: hxops_db,用户: postgres, 密码: difyai123456)
SQLALCHEMY_DATABASE_URI = os.getenv(
'DATABASE_URL',
'postgresql://postgres:difyai123456@localhost:5432/hxops_db'
'postgresql://postgres:123456@8.152.207.171:5432/hxops_db',
)
class ProductionConfig(Config):
DEBUG = False
# 服务器 Ubuntu PostgreSQL 配置
# 注意:在服务器上通过环境变量覆盖,但此处保留默认模板
SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL', 'postgresql://postgres:difyai123456@localhost:5432/hxops_prod')
SQLALCHEMY_DATABASE_URI = os.getenv(
'DATABASE_URL',
'postgresql://postgres:123456@8.152.207.171:5432/hxops_prod',
)
class TestingConfig(Config):
TESTING = True
@@ -55,9 +71,10 @@ class TestingConfig(Config):
WTF_CSRF_ENABLED = False
SQLALCHEMY_ENGINE_OPTIONS = {}
config = {
'development': DevelopmentConfig,
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
'default': DevelopmentConfig,
}