添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Python – Flask-Migrate command ‘flask db init’ can’t find app file

flask flask-migrate flask-sqlalchemy python

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.