首先,我正在关注此处发布的 Python Flask 教程:https : //scotch.io/tutorials/build-a-crud-web-app-with-python-and-flask-part-one。
一切顺利,直到“迁移”部分执行:
$ flask db init
Run Code Online (Sandbox Code Playgroud)
...失败,出现以下错误:
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
Run Code Online (Sandbox Code Playgroud)
我知道 $FLASK_APP 环境变量已设置,因为此命令执行良好:
$ flask run
Run Code Online (Sandbox Code Playgroud)
任何人都可以提出为什么在运行应用程序时执行得很好,但在尝试创建迁移存储库时却没有?
我在该主题的其他地方能找到的最接近的地方是:Flask can't find app file,但 pre-pending withpython -m在这两种情况下对我来说都不起作用。