Skip to content

Commit 24e353a

Browse files
committed
feat: 后端配置文件新增sqlalchemy日志开关配置
1 parent 5bf41c8 commit 24e353a

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

dash-fastapi-backend/.env.dev

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ DB_USERNAME = 'root'
3636
DB_PASSWORD = 'mysqlroot'
3737
# 数据库名称
3838
DB_DATABASE = 'dash-fastapi'
39+
# 是否开启sqlalchemy日志
40+
DB_ECHO = true
3941

4042
# -------- Redis配置 --------
4143
# Redis主机

dash-fastapi-backend/.env.prod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ DB_USERNAME = 'root'
3636
DB_PASSWORD = 'mysqlroot'
3737
# 数据库名称
3838
DB_DATABASE = 'dash-fastapi'
39+
# 是否开启sqlalchemy日志
40+
DB_ECHO = true
3941

4042
# -------- Redis配置 --------
4143
# Redis主机

dash-fastapi-backend/config/database.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
f"{DataBaseConfig.db_host}:{DataBaseConfig.db_port}/{DataBaseConfig.db_database}"
99

1010
engine = create_engine(
11-
SQLALCHEMY_DATABASE_URL, echo=True
11+
SQLALCHEMY_DATABASE_URL, echo=DataBaseConfig.db_echo
1212
)
1313
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
1414
Base = declarative_base()

dash-fastapi-backend/config/env.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ class AppSettings(BaseSettings):
1111
应用配置
1212
"""
1313
app_env: str = 'dev'
14-
app_name: str = 'RuoYi-FasAPI'
14+
app_name: str = 'Dash-FasAPI-Admin'
1515
app_root_path: str = '/dev-api'
1616
app_host: str = '0.0.0.0'
1717
app_port: int = 9099
18-
app_version: str = '1.0.0'
18+
app_version: str = '1.4.0'
1919
app_reload: bool = True
2020

2121

@@ -37,7 +37,8 @@ class DataBaseSettings(BaseSettings):
3737
db_port: int = 3306
3838
db_username: str = 'root'
3939
db_password: str = 'mysqlroot'
40-
db_database: str = 'ruoyi-fastapi'
40+
db_database: str = 'dash-fastapi'
41+
db_echo: bool = True
4142

4243

4344
class RedisSettings(BaseSettings):

0 commit comments

Comments
 (0)