梳理main.py中的服务

This commit is contained in:
mark.tian
2025-12-08 12:31:05 +08:00
parent 43ff4aa5f9
commit 4b0ab3260a
6 changed files with 97 additions and 77 deletions

View File

@@ -6,17 +6,25 @@ class Settings(BaseSettings):
def redis_url(self) -> str:
"""从Celery配置获取Redis URL"""
return self.celery_broker_url
# 数据库配置
database_url: str = ""
# Celery配置
celery_broker_url: str = "redis://localhost:6379/0"
celery_result_backend: str = "redis://localhost:6379/0"
celery_result_backend: str = "redis://localhost:6379/1"
celery_task_serializer: str = "json"
celery_result_serializer: str = "json"
celery_accept_content: list = ["json"]
celery_timezone: str = "UTC"
celery_enable_utc: bool = True
celery_timezone: str = "Asia/Shanghai"
celery_enable_utc: bool = False
# Flower监控配置
flower_enabled: bool = True # 是否启用Flower监控
flower_url: str = "http://localhost:5555" # Flower访问URL
flower_port: int = 5555 # Flower服务端口
flower_url_prefix: str = "" # Flower URL前缀
flower_basic_auth: str = "admin:admin123" # Flower基础认证,格式:username:password
# Redis配置 (从Celery配置获取)
redis_password: str = ""