|
|
楼主 |
发表于 2024-7-11 20:37:16
|
显示全部楼层
from app import db, Y" l7 M0 T1 Q2 J+ @
db.create_all()
. t( Q4 i& q0 @2 ^Traceback (most recent call last):: D! J1 P! t! @6 p/ n. @! C- B' S
File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode6 s/ ?% T" X' s, @+ y8 `) y
coro = func()
0 D; n0 p0 O5 H: \' Y* i1 y ^^^^^^
, _; d- V! H4 Q% Y# s$ S! W File "<input>", line 1, in <module>, g$ ?$ e3 k" b
File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 900, in create_all
1 C/ e1 b1 c6 D" J' q5 x, ? self._call_for_binds(bind_key, "create_all"), W: i" r' l4 U C6 ]- \
File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 871, in _call_for_binds
# b+ ?$ m; F, M/ W( T" w% r engine = self.engines[key]1 H0 w' \$ ~) [4 f( ?: S5 w/ M, N
^^^^^^^^^^^^
/ R2 H- ^. f! P0 x3 z, o0 | File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 687, in engines% T5 ^" ]1 d% _0 ~$ o8 |) z
app = current_app._get_current_object() # type: ignore[attr-defined]+ |" G; E+ a0 z" K; g% z
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^8 m/ i* ~5 q0 t7 G. u* [
File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\werkzeug\local.py", line 519, in _get_current_object- o# V- v9 _7 i }# P! l
raise RuntimeError(unbound_message) from None
3 l! p$ b) ?( C- H1 ?RuntimeError: Working outside of application context.1 l/ j' {/ D) ` _: I7 \7 z1 m* K
This typically means that you attempted to use functionality that needed8 u0 A6 |/ o# t- r9 X
the current application. To solve this, set up an application context; v" Z8 j) r2 Z0 i& |3 u- m
with app.app_context(). See the documentation for more information.
" Y* Q; {8 N7 a/ P |
|