Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask-Migrate command 'flask db init' can't find app file

Firstly, I'm following the Python Flask tutorial posted here: https://scotch.io/tutorials/build-a-crud-web-app-with-python-and-flask-part-one.

Everything was working smoothly up to the 'Migration' section where executing:

$ flask db init

... failed with the following error:

Usage: flask db init [OPTIONS]

Error: The file/path provided (run) does not appear to exist.  Please verify the path is correct.  If app is not on PYTHONPATH, ensure the extension is .py

I know the $FLASK_APP env variable is set because this command executes fine:

$ flask run

Can anyone suggest why this executes fine when running the app, but not when trying to create the migration repository?

The closest I can find elsewhere on the subject is here: Flask can't find app file, but pre-pending with python -m isn't working in either case for me here.

like image 739
mcorrigal Avatar asked Jan 03 '17 11:01

mcorrigal


1 Answers

In my case I had to do

python3 -m flask db init

Without mentioning python3 -m, it shows

zsh: command not found: flask
like image 193
khaidem Avatar answered Nov 15 '22 02:11

khaidem