之前已经:
后来断开连接后,再去连接上服务器,
进入虚拟环境:
[已解决]CentOS中退出了virtualenv之后如何再进入之前virtualenv
再去运行flask,结果出错:
(SIPEvents) SIPEvents flask run –host=0.0.0.0 Usage: flask run [OPTIONS] Error: Could not locate Flask application. You did not provide the FLASK_APP environment variable. For more information see http://flask.pocoo.org/docs/latest/quickstart/ (SIPEvents) SIPEvents |
搜:
flask run Error: Could not locate Flask application. You did not provide the FLASK_APP environment variable.
参考:
python – Error while running Minimal Flask application – Stack Overflow
Could not locate Flask application. You did not provide the FLASK_APP environment variable.
后来才注意到,之前的帖子里:
是先要去设置FLASK_APP这个环境变量的:
export FLASK_APP=hello.py
然后才能运行
而此处的警告,也是提示要去设置FLASK_APP
所以就先去设置,再运行:
(SIPEvents) SIPEvents export FLASK_APP=hello.py (SIPEvents) SIPEvents export FLASK_APP=hello.py (SIPEvents) SIPEvents flask run –host=0.0.0.0 (SIPEvents) SIPEvents export FLASK_DEBUG=1 (SIPEvents) SIPEvents flask run –host=0.0.0.0 * Serving Flask app "hello" * Forcing debug mode on * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger pin code: 353-795-063 |
转载请注明:在路上 » [已解决]CentOS中运行Flask出错:Error Could not locate Flask application You did not provide the FLASK_APP environment variable