'Can't import MigrateCommand from flask_migrate

I made a manage.py file for database migration in a Flask application and I get an error when trying to import MigrateCommand. I'm using PyCharm and I'm sure the package is installed.

Code:

import os
from flask_migrate import Migrate,MigrateCommand
from flask_script import Manager
from app import app, db

app.config.from_object(os.environ['APP_SETTINGS'])

migrate = Migrate(app, db)
manager = Manager(app)

manager.add_command('db', MigrateCommand)


if __name__ == '__main__':
    manager.run()

Error:

Cannot find reference 'MigrateCommand' in '__init__.py' 

Edit:

Like Matteo Pasini answered Flask-Script is no longer supported and the best solution is to use Flask CLI. For anyone wondering what's the equivalent of the manage.py file using Flask CLI I suggest reading this short guide that explains it well:

https://medium.datadriveninvestor.com/migrating-flask-script-to-flask-2-0-cli-4a5eee269139



Solution 1:[1]

The MigrateCommand seems to be no longer supported: https://github.com/miguelgrinberg/Flask-Migrate/issues/407

a possible workaround could be to install an older version of Flask-Migrate, such as:

pip install Flask-Migrate==2.6.0

or switch to the Flask CLI

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matteo Pasini