python flask sqlalchemy 生成数据表报错 求指教
报错内容:
Traceback (most recent call last):
File "G:\studyProject\flaskBlog\app\models.py", line 195, in <module>
db.create_all()
File "G:\studyProject\flaskBlog\venv\lib\site-packages\flask_sqlalchemy\extension.py", line 884, in create_all
self._call_for_binds(bind_key, "create_all")
File "G:\studyProject\flaskBlog\venv\lib\site-packages\flask_sqlalchemy\extension.py", line 855, in _call_for_binds
engine = self.engines[key]
File "G:\studyProject\flaskBlog\venv\lib\site-packages\flask_sqlalchemy\extension.py", line 636, in engines
app = current_app._get_current_object() # type: ignore[attr-defined]
File "G:\studyProject\flaskBlog\venv\lib\site-packages\werkzeug\local.py", line 513, in _get_current_object
raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.