当前位置: 首页 > 工具软件 > gae-init > 使用案例 >

gae mysql_python – 运行GAE开发服务器时,本地MySQLdb连接失败,AttributeError为paramstyle...

韩彦君
2023-12-01

我正在使用Flask-Alchemy,针对Cloud SQL构建GAE Flask应用程序,并在构建应用程序时运行dev_appserver来测试应用程序。

但是,如果将SQLALCHEMY_DATABASE_URI设置为mysql gaerdbms:/// appname?instance = instanceid URL,则在尝试调用db.create_all()时,我会收到以下回溯:

Traceback (most recent call last):

# earlier lines omitted for brevity

File "/Project/app/foo.bar/foo/bar/admin/__init__.py", line 26, in init_db

db.create_all()

File "/Project/app/distlib/flask_sqlalchemy/__init__.py", line 856, in create_all

self._execute_for_all_tables(app, bind, 'create_all')

File "/Project/app/distlib/flask_sqlalchemy/__init__.py", line 848, in _execute_for_all_tables

op(bind=self.get_engine(app, bind), tables=tables)

File "/Project/app/distlib/flask_sqlalchemy/__init__.py", line 797, in get_engine

return connector.get_engine()

File "/Project/app/distlib/flask_sqlalchemy/__init__.py", line 473, in get_engine

self._engine = rv = sqlalchemy.create_engine(info, **options)

File "/Project/app/distlib/sqlalchemy/engine/__init__.py", line 332, in create_engine

return strategy.create(*args, **kwargs)

File "/Project/app/distlib/sqlalchemy/engine/strategies.py", line 69, in create

dialect = dialect_cls(**dialect_args)

File "/Project/app/distlib/sqlalchemy/dialects/mysql/base.py", line 1986, in __init__

default.DefaultDialect.__init__(self, **kwargs)

File "/Project/app/distlib/sqlalchemy/engine/default.py", line 124, in __init__

self.paramstyle = self.dbapi.paramstyle

AttributeError: 'module' object has no attribute 'paramstyle'

是什么赋予了?为什么缺少(DB-API 2.0)paramstyle属性?

 类似资料: