Python Flask.ext.mysql Is Deprecated?
Solution 1:
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.
Solution 2:
flask.ext.X
is the old form to import a Flask extension, it is deprecated since Flask v0.10. The new way is to use flask_X
. That's why you got the first warning.
But apparently, Flask-MySQL does not update it's name form and use the flaskext
as the package name (chedck it on GitHub). That's why you got the second warning.
Post a Comment for "Python Flask.ext.mysql Is Deprecated?"