Files
aitsc/config/__init__.py
renjianbo 8ddd7ddfc7 fix: 修复启动问题并简化首页
- 添加 load_dotenv() 确保环境变量在配置加载前生效
- 修复 static_folder 路径指向正确的静态文件目录
- 移除 flask-admin 2.x 不支持的 template_mode 参数
- 简化首页,移除特色功能卡片区域

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-27 21:19:46 +08:00

38 lines
859 B
Python

import os
from dotenv import load_dotenv
load_dotenv()
from .base import Config
from .development import DevelopmentConfig
from .production import ProductionConfig
from .testing import TestingConfig
from .local import LocalConfig
# 配置映射字典
config_map = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'testing': TestingConfig,
'local': LocalConfig,
'default': DevelopmentConfig
}
def get_config():
"""
根据环境变量获取对应的配置类
环境变量: FLASK_ENV
可选值: development, production, testing, local
"""
env = os.environ.get('FLASK_ENV', 'development')
return config_map.get(env, config_map['default'])
# 导出配置类
__all__ = [
'Config',
'DevelopmentConfig',
'ProductionConfig',
'TestingConfig',
'LocalConfig',
'get_config'
]