我试图对我的烧瓶应用程序进行身份验证,然后我开始按照本教程进行操作: https://www.digitalocean.com/community/tutorials/how-to-add-authentication-to-your-app-with-flask-login
然后我遇到以下问题:
127.0.0.1 - - [29/Aug/2020 21:46:13] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/gabriel_rc/4Linux/flask_auth_app/project/__init__.py", line 2, in <module>
from flask_sqlalchemy import SQLAlchemy
ModuleNotFoundError: No module named 'flask_sqlalchemy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/gabriel_rc/.pyenv/versions/3.7.2/lib/python3.7/site-packages/flask/cli.py", line 338, in __call__
self._flush_bg_loading_exception()
File "/home/gabriel_rc/.pyenv/versions/3.7.2/lib/python3.7/site-packages/flask/cli.py", line 326, in _flush_bg_loading_exception
reraise(*exc_info)
File "/home/gabriel_rc/.pyenv/versions/3.7.2/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/gabriel_rc/.pyenv/versions/3.7.2/lib/python3.7/site-packages/flask/cli.py", line 314, in _load_app
self._load_unlocked()
File "/home/gabriel_rc/.pyenv/versions/3.7.2/lib/python3.7/site-packages/flask/cli.py", line 330, in _load_unlocked
self._app = rv = self.loader()
File "/home/gabriel_rc/.pyenv/versions/3.7.2/lib/python3.7/site-packages/flask/cli.py", line 388, in load_app
app = locate_app(self, import_name, name)
File "/home/gabriel_rc/.pyenv/versions/3.7.2/lib/python3.7/site-packages/flask/cli.py", line 247, in locate_app
"\n\n{tb}".format(name=module_name, tb=traceback.format_exc())
flask.cli.NoAppException: While importing "project", an ImportError was raised:
Traceback (most recent call last):
File "/home/gabriel_rc/.pyenv/versions/3.7.2/lib/python3.7/site-packages/flask/cli.py", line 240, in locate_app
__import__(module_name)
File "/home/gabriel_rc/4Linux/flask_auth_app/project/__init__.py", line 2, in <module>
from flask_sqlalchemy import SQLAlchemy
ModuleNotFoundError: No module named 'flask_sqlalchemy'
Ps:以下档案 / home / gabriel_rc / 4Linux / flask_auth_app / project / init .py 与我的教程相同提到。
我该如何解决这个问题?
答案 0 :(得分:0)
您可以执行pip install Flask-SQLAlchemy