找回密码
 注册
查看: 12|回复: 0

调试报错 raise RuntimeError(unbound_message) from None RuntimeError: Working outsi

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2024-7-31 00:02:44 | 显示全部楼层 |阅读模式
db.create_all()
; A% {( V' B; v, l* H# [6 ZTraceback (most recent call last):. R+ v, e0 }$ k
  File "F:\Program Files\JetBrains\PyCharm Community Edition 2023.2.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode7 l, X; d" b0 ]) {; ~2 Q
    coro = func()
- D/ U3 t1 y# D7 V$ Q' j' d4 R3 t           ^^^^^^# X% a, o: Y/ D
  File "<input>", line 1, in <module>( G" i9 E, \. {0 V: F
  File "G:\Users\longrui\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask_sqlalchemy\extension.py", line 900, in create_all
7 [9 k* }! j) g- b    self._call_for_binds(bind_key, "create_all")' {( S. D& h6 D' z" i- ?
  File "G:\Users\longrui\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask_sqlalchemy\extension.py", line 871, in _call_for_binds
* I6 M/ B  E* ?7 W    engine = self.engines[key]
) s# _5 p: d1 m( x7 P* ~             ^^^^^^^^^^^^8 P$ J+ t4 a8 Z3 {
  File "G:\Users\longrui\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask_sqlalchemy\extension.py", line 687, in engines9 g7 H% Q& i# K5 b* m
    app = current_app._get_current_object()  # type: ignore[attr-defined]/ S$ I: L, ^% r% x
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 x2 }7 }( a2 y! c4 R3 j, z  File "G:\Users\longrui\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\local.py", line 519, in _get_current_object
. Y* x) _8 ^2 v3 J  y$ f) i    raise RuntimeError(unbound_message) from None+ d: z0 N6 A9 f/ \  ~+ k
RuntimeError: Working outside of application context.
! ]# Y. U; g; N  TThis typically means that you attempted to use functionality that needed2 {3 a! B, ?/ p
the current application. To solve this, set up an application context! n2 m& F4 r/ r! ^# M, F5 P8 r- p
with app.app_context(). See the documentation for more information.4 B! _( A: T1 p; l- I6 J
- ?# Q; D; g( M0 G
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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