易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 8|回复: 2
收起左侧

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

[复制链接]
发表于 2024-7-11 20:29:54 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
  raise RuntimeError(unbound_message) from None1 @1 ~  d% X" Z# U: l' ]
RuntimeError: Working outside of application context.
6 U; {2 E1 x* o7 Z$ pThis typically means that you attempted to use functionality that needed* S4 L  H; F9 e4 H; G

2 o/ J/ J# T. q
 楼主| 发表于 2024-7-11 20:36:42 | 显示全部楼层
db.create_all() Traceback (most recent call last):
 楼主| 发表于 2024-7-11 20:37:16 | 显示全部楼层
from app import db
) Q4 P% n3 j. r8 y/ e$ E" ?db.create_all()7 R/ o7 e/ E. y# l6 f
Traceback (most recent call last):
% k/ j  r% y  O8 M. i" n  File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.1\plugins\python-ce\helpers\pydev\pydevconsole.py", line 364, in runcode" i! H8 s8 F- K0 U
    coro = func()
0 W5 i& U+ c5 |- O. h% B           ^^^^^^* }; B/ D! Z5 l" o
  File "<input>", line 1, in <module>! p# C- I' C  V. n
  File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 900, in create_all
1 b) h' u# _# y  ~1 h    self._call_for_binds(bind_key, "create_all")
) `% I+ o/ A# L+ ?' J  File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 871, in _call_for_binds
" l) Q/ @' m4 ?1 c    engine = self.engines[key]
* z9 t( i- H& z             ^^^^^^^^^^^^
6 }6 S8 Q. a" ?/ W; H% H& R. @  File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\flask_sqlalchemy\extension.py", line 687, in engines% v) l& q. F  `: g. e- K2 x& u7 \/ [' g3 _
    app = current_app._get_current_object()  # type: ignore[attr-defined]
9 E0 r4 U2 p+ O          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^1 P8 C4 G# I2 f+ s/ Q
  File "C:\Users\admin\AppData\Local\Programs\Python\Python312\Lib\site-packages\werkzeug\local.py", line 519, in _get_current_object
4 |/ k# s7 I$ |8 J7 q    raise RuntimeError(unbound_message) from None! D7 O2 F$ T$ Y1 X
RuntimeError: Working outside of application context.
: j! H  \( _9 ^, C( }, vThis typically means that you attempted to use functionality that needed( p* p" C3 \, w4 S9 G# x+ A
the current application. To solve this, set up an application context
* U9 ?* g/ E; I4 g4 kwith app.app_context(). See the documentation for more information.0 k- t+ ?; ]1 [' G
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:29 , Processed in 0.047745 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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