在终端中运行
flask initdb
提示错误:
Error: No such command “initdb”.
终端运行 flask shell
PS C:\Users\Gux\Documents\flask_project\sayhello> flask shell
Usage: flask shell [OPTIONS]Error: Could not import “sayhello.sayhello”.
启动程序 flask run 并不报错,但是浏览器访问报错
flask.cli.NoAppException
flask.cli.NoAppException: While importing “sayhello.sayhello”, an ImportError was raised:Traceback (most recent call last):
File “c:\users\gux.virtualenvs\sayhello-cvycmk-d\lib\site-packages\flask\cli.py”, line 235, in locate_app
import(module_name)
File “C:\Users\Gux\Documents\flask_project\sayhello_init_.py”, line 11, in
app.config.from_pyfile(‘settings.py’)
File “c:\users\gux.virtualenvs\sayhello-cvycmk-d\lib\site-packages\flask\config.py”, line 130, in
from_pyfile
exec(compile(config_file.read(), filename, 'exec'), d.__dict__)
File “C:\Users\Gux\Documents\flask_project\sayhello\settings.py”, line 4, in
from . import app, db
ModuleNotFoundError: No module named ‘config’