Flask_web-template/app/config.py
Wensheng eed9a61550 史詩級的優化
改善註釋方式
2024-10-30 02:24:02 +08:00

28 lines
771 B
Python

import os
try:
from dotenv import load_dotenv
load_dotenv()
except ImportError:
pass
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'default-secret-key'
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
'sqlite:///app.db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
# 其他配置項
MAIL_SERVER = os.environ.get('MAIL_SERVER')
MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
# 用戶大頭貼
POSTS_PER_PAGE = 10
DEFAULT_PAGE_SIZE = 10
UPLOAD_FOLDER = 'static/uploads'
MAX_CONTENT_LENGTH = 1 * 1024 * 1024 # 1MB