32 lines
829 B
Python
32 lines
829 B
Python
import os
|
|
import secrets
|
|
|
|
# 数据库配置
|
|
DATABASE_URI = "mysql+pymysql://root:123456@localhost:3306/equipment_cost_db"
|
|
|
|
# 安全密钥配置(自动生成随机密钥)
|
|
SECRET_KEY = secrets.token_hex(16)
|
|
|
|
# 环境配置
|
|
DEBUG = False
|
|
ENV = 'production'
|
|
|
|
# 文件上传配置
|
|
UPLOAD_FOLDER = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'uploads')
|
|
ALLOWED_EXTENSIONS = {'csv', 'xlsx', 'xls', 'json'}
|
|
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB 最大上传限制
|
|
|
|
# API配置
|
|
API_VERSION = 'v1'
|
|
API_PREFIX = f'/api/{API_VERSION}'
|
|
|
|
# 跨域配置
|
|
CORS_ORIGINS = [
|
|
"http://localhost:8080",
|
|
"http://127.0.0.1:8080",
|
|
]
|
|
|
|
# 日志配置
|
|
LOG_LEVEL = 'DEBUG'
|
|
LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
LOG_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logs/app.log') |