找回密码
 注册
查看: 13|回复: 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
0 Y0 P+ o, A" lRuntimeError: Working outside of application context.
  t+ C- O1 B! F5 r5 v: V( L/ OThis typically means that you attempted to use functionality that needed( P7 i) X6 T' j9 l

" s; {# x, Y. G  @

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+ ~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% `
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 00:27 , Processed in 0.013585 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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