Flask在退出调试模式时可以正常工作。但是当我尝试运行它时,git bash
FLASK_APP=flaskapp.py FLASK_DEBUG=1 flask run
我得到:
* Serving Flask app "flaskapp.py" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
c:\users\aidan\documents\projects\flask_test\environments\flask\scripts\python.exe: No module named C:\Users\aidan\documents\projects\flask_test\environments\flask\Scripts\flask
我不确定为什么会那样做,因为确实存在。 我的代码是
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return '<h1>Hello World out there!</h1>'
Versions:
Flask version = 1.1.1
Python = 3.7.3
Pip = 19.2.2
我通过pip将Flask安装到我的virtualenv文件夹中,当我运行它时,我就在我的virtualenv中。