Files
aitsc/config/development.py
renjianbo 94cbc7f7c0 feat: 添加版本号 v1.0.0 和版本管理功能
- 在 src/flask_prompt_master/__init__.py 添加 __version__ 和 __version_info__
- 创建 VERSION 文件存储版本号
- 更新所有环境配置(development/production/testing/local/base)在启动时显示版本信息
- 更新 README.md 文档添加版本号显示

版本号: v1.0.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 18:02:02 +08:00

77 lines
2.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from .base import Config
class DevelopmentConfig(Config):
"""
开发环境配置
"""
DEBUG = True
TESTING = False
# 开发环境数据库配置如果未设置环境变量使用SQLite
def __init__(self):
super().__init__()
if not self.SQLALCHEMY_DATABASE_URI:
self.SQLALCHEMY_DATABASE_URI = 'sqlite:///dev.db'
# 开发环境API配置如果未设置使用示例值并给出警告
if not self.LLM_API_KEY:
self.LLM_API_KEY = 'sk-dev-example-api-key'
import warnings
warnings.warn("LLM_API_KEY not set, using development example key")
if not self.WX_APPID:
self.WX_APPID = 'wx-dev-example-appid'
if not self.WX_SECRET:
self.WX_SECRET = 'wx-dev-example-secret'
# 开发环境CORS配置如果没有设置使用开发默认值
if not self.CORS_ORIGINS or self.CORS_ORIGINS == ['']:
self.CORS_ORIGINS = ['http://localhost:3000', 'http://127.0.0.1:3000', '*']
# 开发环境日志配置
LOG_LEVEL = 'DEBUG'
LOG_FILE = 'logs/dev.log'
# 开发环境缓存配置
CACHE_TYPE = 'simple'
CACHE_DEFAULT_TIMEOUT = 60 # 开发环境缓存时间较短
# 开发环境安全配置
WTF_CSRF_ENABLED = False # 开发环境关闭CSRF保护
# 开发环境会话配置
SESSION_LIFETIME_HOURS = 24
# 开发环境文件上传配置
MAX_CONTENT_LENGTH = 32 * 1024 * 1024 # 32MB
UPLOAD_FOLDER = 'uploads/dev'
# 开发环境跨域配置
CORS_ORIGINS = ['http://localhost:3000', 'http://127.0.0.1:3000', '*']
@staticmethod
def init_app(app):
Config.init_app(app)
# 开发环境特定初始化
import logging
app.logger.setLevel(logging.DEBUG)
# 开发环境控制台输出
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG)
console_handler.setFormatter(logging.Formatter(
'%(asctime)s %(levelname)s: %(message)s'
))
app.logger.addHandler(console_handler)
# 获取版本信息
try:
from src.flask_prompt_master import __version__
version_info = f"版本: {__version__}"
except ImportError:
version_info = "版本: 未知"
app.logger.info(f'开发环境启动 - {version_info}')