Python flask.ext.mysql is deprecated?

前端 未结 2 1171
暖寄归人
暖寄归人 2020-12-06 14:17

When I run from flask.ext.mysql import MySQL I get the warning Importing flask.ext.mysql is deprecated, use flask_mysql instead.

So I inst

2条回答
  •  一整个雨季
    2020-12-06 15:01

    flask.ext. is a deprecated pattern which was used prevalently in older extensions and tutorials. The warning is telling you to replace it with the direct import, which it guesses to be flask_mysql. However, Flask-MySQL is using an even more outdated pattern, flaskext.. There is nothing you can do about that besides convincing the maintainer to release a new version that fixes it. from flaskext.mysql import MySQL should work and avoid the warning, although preferably the package would be updated to use flask_mysql instead.

提交回复
热议问题