1. 依赖版本:
alembic==1.6.5
click==8.0.1
colorama==0.4.4
Flask==1.1.2
Flask-Migrate==2.7.0
Flask-Script==2.0.6
Flask-SQLAlchemy==2.4.4
greenlet==1.1.0
itsdangerous==2.0.1
Jinja2==3.0.1
Mako==1.1.4
MarkupSafe==2.0.1
protobuf==3.17.3
PyMySQL==1.0.2
python-dateutil==2.8.1
python-editor==1.0.4
six==1.16.0
SQLAlchemy==1.3.24
Werkzeug==2.0.1
2. 代码
from flask import Flask
from flask_migrate import Migrate, MigrateCommand
from flask_script import Managerimport random
from functools import partialfrom flask import current_app
from flask_sqlalchemy import SignallingSession, SQLAlchemy, get_state
from sqlalchemy import ormclass RoutingSession(SignallingSession):"""路由Session,实现读写分离路由(手动)"""def