Can't import MigrateCommand from flask_migrate


I made a 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.


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


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

manager.add_command('db', MigrateCommand)

if __name__ == '__main__':


Cannot find reference 'MigrateCommand' in '' 


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 file using Flask CLI I suggest reading this short guide that explains it well:


The MigrateCommand seems to be no longer supported:

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

Answered By – Matteo Pasini

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published