flask.cli.NoAppException: Could not import “flaskr.flaskr”
我正在努力:http://flask.pocoo.org/docs/1.0/tutorial/
我已经在a/flaskr/目录中编写了
然后,我在命令行的flaskr目录中运行这些命令,正如"运行应用程序"建议的那样:(
我应该看到的是
相反,我遇到了以下错误:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Traceback (most recent call last): File"/Users/David/Desktop/flaskr/venv/lib/python3.6/site-packages/flask/cli.py", line 330, in __call__ rv = self._load_unlocked() File"/Users/David/Desktop/flaskr/venv/lib/python3.6/site-packages/flask/cli.py", line 317, in _load_unlocked self._app = rv = self.loader() File"/Users/David/Desktop/flaskr/venv/lib/python3.6/site-packages/flask/cli.py", line 372, in load_app app = locate_app(self, import_name, name) File"/Users/David/Desktop/flaskr/venv/lib/python3.6/site-packages/flask/cli.py", line 246, in locate_app 'Could not import"{name}".'.format(name=module_name) flask.cli.NoAppException: Could not import"flaskr.flaskr". |
简单地说,我不确定应该如何响应或修复这样的错误。也许我在venv中安装的东西和这个特定项目需要什么不匹配?
像此人:无法导入熊猫:类型错误
瓶:
/Users/David/Desktop/flaskr/venv/bin/Flask - 版本:1.0.2
Pip:
from /Users/David/Desktop/flaskr/venv/lib/python3.6/site-packages (python 3.6) - 版本:0.0.1
Python:
/Users/David/Desktop/flaskr/venv/bin/python - 版本:3.6
我想你放错文件夹了。你可能做到了:
1 | cd flask_tutorial/flaskr |
您需要转到教程文件夹:
1 | cd .. |
你应该在