Flask-Migrate "ModuleNotFoundError"
I can see that you solved the problem, but I want to show you the simpler solution than installing flask-script
and creating manage.py
file. You just have to delete __init__.py
file that is at the same level as app.py file. It solved the problem for me. Cheers :)
To solve your problem I will suggest using flask_script instead flask cli. Simply create manage.py file in your root directory and then do as follows:
from flask_migrate import Migrate, MigrateCommandfrom flask_script import Managermigrate = Migrate(app, db)manager = Manager(app)manager.add_command('db', MigrateCommand)
To launch migration simply do:python manage.py db migrate
or python3 manage.py migrate
(depends on your PATH configuration)