- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|

楼主 |
发表于 2024-7-11 20:37:16
|
显示全部楼层
from app import db
) Q4 P% n3 j. r8 y/ e$ E" ?db.create_all()7 R/ o7 e/ E. y# l6 f
Traceback (most recent call last):
% k/ j r% y O8 M. i" n File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode" i! H8 s8 F- K0 U
coro = func()
0 W5 i& U+ c5 |- O. h% B ^^^^^^* }; B/ D! Z5 l" o
File "<input>", line 1, in <module>! p# C- I' C V. n
File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 900, in create_all
1 b) h' u# _# y ~1 h self._call_for_binds(bind_key, "create_all")
) `% I+ o/ A# L+ ?' J File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 871, in _call_for_binds
" l) Q/ @' m4 ?1 c engine = self.engines[key]
* z9 t( i- H& z ^^^^^^^^^^^^
6 }6 S8 Q. a" ?/ W; H% H& R. @ File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 687, in engines% v) l& q. F `: g. e- K2 x& u7 \/ [' g3 _
app = current_app._get_current_object() # type: ignore[attr-defined]
9 E0 r4 U2 p+ O ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^1 P8 C4 G# I2 f+ s/ Q
File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\werkzeug\local.py", line 519, in _get_current_object
4 |/ k# s7 I$ |8 J7 q raise RuntimeError(unbound_message) from None! D7 O2 F$ T$ Y1 X
RuntimeError: Working outside of application context.
: j! H \( _9 ^, C( }, vThis typically means that you attempted to use functionality that needed( p* p" C3 \, w4 S9 G# x+ A
the current application. To solve this, set up an application context
* U9 ?* g/ E; I4 g4 kwith app.app_context(). See the documentation for more information.0 k- t+ ?; ]1 [' G
|
|