找回密码
 注册
查看: 14|回复: 2

raise RuntimeError(unbound_message) from None RuntimeError: Working outside of a

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2024-7-11 20:29:54 | 显示全部楼层 |阅读模式
  raise RuntimeError(unbound_message) from None
2 x# _7 M# i. GRuntimeError: Working outside of application context.
$ v. W; L, h9 W) ]1 L, S) k" I; dThis typically means that you attempted to use functionality that needed
+ g6 b  Q' t5 _( z
% a& P+ w9 w% ?; b: q

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2024-7-11 20:36:42 | 显示全部楼层
db.create_all() Traceback (most recent call last):

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:32 , Processed in 0.017048 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表