You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PS D:\python-script\flask-learning>&"D:/Program Files/Python3.10/python.exe" d:/python-script/flask-learning/test_watchlist.py
EE
======================================================================
ERROR: test_app_exist (__main__.WatchlistTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "d:\python-script\flask-learning\test_watchlist.py", line 15, in setUp
db.create_all()
File "D:\Program Files\Python3.10\Lib\site-packages\flask_sqlalchemy\extension.py", line 887, in create_all
self._call_for_binds(bind_key, "create_all")
File "D:\Program Files\Python3.10\Lib\site-packages\flask_sqlalchemy\extension.py", line 858, in _call_for_binds
engine = self.engines[key]
File "D:\Program Files\Python3.10\Lib\site-packages\flask_sqlalchemy\extension.py", line 639, in engines
app = current_app._get_current_object() # type: ignore[attr-defined]
File "D:\Program Files\Python3.10\Lib\site-packages\werkzeug\local.py", line 508, 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.
PS D:\python-script\flask-learning>&"D:/Program Files/Python3.10/python.exe" d:/python-script/flask-learning/test_watchlist.py
..
----------------------------------------------------------------------
Ran 2 tests in 1.145s
OK
PS D:\python-script\flask-learning>
The text was updated successfully, but these errors were encountered:
· Flask == 2.3.2
· Flask-Login == 0.6.2
· Flask-SQLAlchemy == 3.0.5
· SQLAlchemy == 2.0.17
出现如下报错
** 看报错似乎为上下文的异常,我修改后的代码运行,可以通过测试,但是存在的问题是app.config.update里面的配置未生效,使用的还是原文件的SQLALCHEMY_DATABASE_URI配置,导致会覆盖开发环境的数据
** 测试通过,但是开发数据库被覆盖了
The text was updated successfully, but these errors were encountered: