Files
UploaderHui/nas-uploader/config.py
2026-04-18 15:08:57 +08:00

30 lines
705 B
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.
import os
from dotenv import load_dotenv
# 加载 .env 文件
load_dotenv()
# NAS图片存储根目录
NAS_DATA_PATH = os.getenv('NAS_DATA_PATH', '/volume1/nas_data')
# 服务端口
PORT = int(os.getenv('PORT', '5000'))
# 允许的图片格式
ALLOWED_EXTENSIONS = os.getenv('ALLOWED_EXTENSIONS', 'jpg,jpeg,png,gif,webp').split(',')
# 单次上传最大文件数量
MAX_FILES_COUNT = int(os.getenv('MAX_FILES_COUNT', '100'))
# 单张图片最大大小MB
MAX_FILE_SIZE_MB = int(os.getenv('MAX_FILE_SIZE_MB', '20'))
# 允许的MIME类型映射
ALLOWED_MIME_TYPES = {
'jpg': 'image/jpeg',
'jpeg': 'image/jpeg',
'png': 'image/png',
'gif': 'image/gif',
'webp': 'image/webp',
}