|
|
楼主 |
发表于 2024-7-11 20:37:16
|
显示全部楼层
from app import db+ ~3 N6 g* E8 k+ W$ [
db.create_all(), P. j0 C% v" p6 U! G' P6 d
Traceback (most recent call last):) K; c# }2 r z6 r7 x1 h* U
File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode% o5 @( @" d7 C/ P0 Y1 e2 c
coro = func()3 _# [% M- I' Y' S; W3 |. f
^^^^^^
; |& ]/ {' W9 d File "<input>", line 1, in <module>
! a: w* B; V/ S! {$ K' ^2 M File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 900, in create_all8 a! G+ \ w* w7 W6 u6 n
self._call_for_binds(bind_key, "create_all")
. ~/ H) k) T* w! i6 ~. X File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 871, in _call_for_binds
& [: G' ~% x2 H7 X: ?5 ~ engine = self.engines[key]
7 }- _8 r# _( e4 e# [! Q ^^^^^^^^^^^^: L) `4 P* L" L6 M4 `
File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 687, in engines6 k# g9 w4 ]) s5 O- j$ c
app = current_app._get_current_object() # type: ignore[attr-defined]
+ E) z' H: Q0 A7 C ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
' x" @) u$ c/ Y* S# i. l File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\werkzeug\local.py", line 519, in _get_current_object/ [' ]+ U' L2 l* g
raise RuntimeError(unbound_message) from None5 C( I8 |' _' \$ i7 Q* s* I
RuntimeError: Working outside of application context.
_) H6 A: H9 T7 F0 FThis typically means that you attempted to use functionality that needed" i) W) [# a a7 I$ p; d
the current application. To solve this, set up an application context
& O, b# x/ Y( \with app.app_context(). See the documentation for more information.
7 u' R: y i0 }# B/ Z% ` |
|