找回密码
 注册
查看: 17|回复: 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
5 a; C7 \4 t2 d1 f' A* n; n" hRuntimeError: Working outside of application context.
4 |7 x1 v; x6 A. D  x3 L" UThis typically means that you attempted to use functionality that needed
' N9 ?% I/ z4 r# K- e& V8 `. s# F5 `$ k. R. m8 [9 z9 O

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
2 M* Y+ s! I$ Y; O' jdb.create_all()
& y" a) b8 c7 Q+ _5 BTraceback (most recent call last):
& J! ], |+ z0 L! @. f0 A  File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode
- K  C4 |# o* V: u  a    coro = func()1 b( s3 K* Z( v( B  P
           ^^^^^^! \$ I5 \( X1 Y. q5 @. r$ r' A* y) q
  File "<input>", line 1, in <module>
* z7 A/ h' I. g8 A/ P/ g  File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 900, in create_all8 {8 o, u3 T* i
    self._call_for_binds(bind_key, "create_all")
0 i7 Z# n" f  z, i+ O# t  File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 871, in _call_for_binds
/ ^) c; F. p2 q) H    engine = self.engines[key], h- G3 M0 n( Y2 W( Y
             ^^^^^^^^^^^^
7 ?0 ~; `" l: X  File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 687, in engines
7 E4 n3 `1 W1 i! g    app = current_app._get_current_object()  # type: ignore[attr-defined]
/ V) Q' u+ j% @- Q8 C+ m. p! `' s          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^9 U( T) E# E  Y4 g/ c& A
  File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\werkzeug\local.py", line 519, in _get_current_object
. z  f' l" _9 F8 W    raise RuntimeError(unbound_message) from None
. T5 `7 b1 F6 X1 ?9 W- g/ _0 p9 RRuntimeError: Working outside of application context.
1 m5 }5 O/ _) z! n  G8 uThis typically means that you attempted to use functionality that needed3 g" H; I- R% D( G, B
the current application. To solve this, set up an application context# `& m- B- P3 P  Q
with app.app_context(). See the documentation for more information.! f. N% [7 ?0 `" k, V& `
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 01:31 , Processed in 0.020913 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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