Flask app getting error of “could not locate flask application. …FLASK_APP environment variable” for Flask Migrate

左心房为你撑大大i 提交于 2019-12-01 10:48:40

The flask command line argument needs to know what module to locate the current Flask app instance in.

Set FLASK_APP as an environment variable:

export FLASK_APP=db_table.py

before running your flask command-line app.

See the Command Line Interface documentation:

For the flask script to work, an application needs to be discovered. This is achieved by exporting the FLASK_APP environment variable. It can be either set to an import path or to a filename of a Python module that contains a Flask application.

You can also set the variable per command by setting it on the same command line:

FLASK_APP=db_table.py flask db init
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!