File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ examples/auth/
9393- ** fastapi-jwt** (用於 JWT 驗證)
9494- ** redis** (非同步用戶端)
9595- ** SQLAlchemy** (非同步的資料庫操作)
96- - ** asyncmy ** (非同步的 MySQL 驅動程式,或可依需求替換成其他 RDBMS)
96+ - ** aiomysql ** (非同步的 MySQL 驅動程式,或可依需求替換成其他 RDBMS)
9797- ** werkzeug** (用於密碼雜湊)
9898- ** apscheduler** (用於排程工作)
9999- ** python-dotenv** (用於讀取環境變數)
@@ -125,8 +125,8 @@ examples/auth/
125125JWT_SECRET_KEY=" your_super_secret_key"
126126
127127# SQLAlchemy 資料庫連線 URI
128- # 例如 MySQL: mysql+asyncmy ://<user>:<password>@<host>/<database_name>
129- DATABASE_URL=" mysql+asyncmy ://user:password@localhost/dbname"
128+ # 例如 MySQL: mysql+aiomysql ://<user>:<password>@<host>/<database_name>
129+ DATABASE_URL=" mysql+aiomysql ://user:password@localhost/dbname"
130130
131131# Redis 連線資訊
132132REDIS_HOST=" 127.0.0.1"
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ All required Python packages are listed in the `requirements.txt` file. The main
9393- ** fastapi-jwt** (for handling JWT-based security)
9494- ** redis** (asynchronous client)
9595- ** SQLAlchemy** (async engine for database interactions)
96- - ** asyncmy ** (async MySQL driver, or adapt to the RDBMS of your choice)
96+ - ** aiomysql ** (async MySQL driver, or adapt to the RDBMS of your choice)
9797- ** werkzeug** (for password hashing)
9898- ** apscheduler** (for scheduled tasks)
9999- ** python-dotenv** (for loading environment variables)
@@ -125,8 +125,8 @@ Create a `.env` file in the `examples/auth` directory (or your project’s root)
125125JWT_SECRET_KEY=" your_super_secret_key"
126126
127127# SQLAlchemy database connection URI
128- # e.g. MySQL: mysql+asyncmy ://<user>:<password>@<host>/<database_name>
129- DATABASE_URL=" mysql+asyncmy ://user:password@localhost/dbname"
128+ # e.g. MySQL: mysql+aiomysql ://<user>:<password>@<host>/<database_name>
129+ DATABASE_URL=" mysql+aiomysql ://user:password@localhost/dbname"
130130
131131# Redis connection details
132132REDIS_HOST=" 127.0.0.1"
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class Settings(BaseSettings):
1919 or 'your_fallback_secret_key' if not set.
2020 sqlalchemy_database_uri (str): The database connection URI (async).
2121 Defaults to the value of the DATABASE_URL environment variable
22- or 'mysql+asyncmy ://user:password@localhost/dbname' if not set.
22+ or 'mysql+aiomysql ://user:password@localhost/dbname' if not set.
2323 sqlalchemy_track_modifications (bool): Indicates whether SQLAlchemy
2424 should track modifications. Defaults to False.
2525 """
@@ -28,7 +28,7 @@ class Settings(BaseSettings):
2828 'JWT_SECRET_KEY' , 'your_fallback_secret_key' ,
2929 )
3030 sqlalchemy_database_uri : str = os .getenv (
31- 'DATABASE_URL' , 'mysql+asyncmy ://user:password@localhost/dbname' ,
31+ 'DATABASE_URL' , 'mysql+aiomysql ://user:password@localhost/dbname' ,
3232 )
3333 sqlalchemy_track_modifications : bool = False
3434
Original file line number Diff line number Diff line change 1515# Create an asynchronous SQLAlchemy engine
1616# using the database URI from settings.
1717engine = create_async_engine (
18- settings .sqlalchemy_database_uri .replace ('mysql://' , 'mysql+asyncmy ://' ),
18+ settings .sqlalchemy_database_uri .replace ('mysql://' , 'mysql+aiomysql ://' ),
1919 pool_recycle = 3600 ,
2020)
2121
You can’t perform that action at this time.
0 commit comments