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

django.db.utils.OperationalError: (2002, "Can't connect to server on '192.1

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2026-1-8 08:15:54 | 显示全部楼层 |阅读模式
. y* B  ]* d0 ?+ x7 g- x8 G5 ^3 ?
python manage.py runserver 0.0.0.0:8000
  i8 z2 R& Y( o6 V6 e* GWatching for file changes with StatReloader: I! v: ]3 t) c& i3 h
Performing system checks...# f; R# `; @$ h# z  }5 z" h
# _. m* ?: P3 m7 C4 `2 H
System check identified no issues (0 silenced).
4 I7 @4 I2 K" ?6 {5 h) b2 @# _Exception in thread django-main-thread:
, m& d8 L5 N% G; m( d2 nTraceback (most recent call last):/ Y0 p' c# e4 F8 L( j( x
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 279, in ensure_connection* F0 E" K! [& Z* K; b5 y5 x. T
    self.connect()6 F7 v, f3 Z9 L4 @% q  L, J6 S
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner  R9 r' i7 C3 j4 {% C, R4 K; \
    return func(*args, **kwargs)( I) p+ ], Y4 V0 T& p# L* @
           ^^^^^^^^^^^^^^^^^^^^^
+ b6 {7 B3 t+ S( T  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect
8 \" W5 A5 t% K$ X$ b* f) P3 f    self.connection = self.get_new_connection(conn_params)0 w$ z& R' n: P
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9 i2 U. L6 H7 Z; ?2 y+ v) V  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner. w( s; ]- L# f5 \7 f
    return func(*args, **kwargs)+ T" o& G0 [. b2 \
           ^^^^^^^^^^^^^^^^^^^^^+ l) S& J0 Y1 }$ }( B- t4 j4 T
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/mysql/base.py", line 258, in get_new_connection
3 U1 Q- j0 ^% ]# A    connection = Database.connect(**conn_params)) w3 e& R5 i% E
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^, X/ p2 C; B2 M1 t4 q. k, I9 K4 \
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/MySQLdb/__init__.py", line 121, in Connect
# b5 w6 ]. d8 n: I7 E, |    return Connection(*args, **kwargs)' B" a9 [2 }9 c; g2 K
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
* M1 b: s. x8 o8 R% p- O6 Q  ]  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/MySQLdb/connections.py", line 200, in __init__
( S# n) p# ~: b4 D9 F6 E    super().__init__(*args, **kwargs2)3 {1 G: F% y& Y4 q& r  ^7 ?" ]
MySQLdb.OperationalError: (2002, "Can't connect to server on '192.168.16.37' (115)")
: ~" W8 k' m3 k% ]( S; U& U
/ Y0 F; W! B. [The above exception was the direct cause of the following exception:' Q3 g/ k- U5 L1 b' ]" c0 f
1 N7 a" w; A6 a4 U: E! ]9 {# `' Y
Traceback (most recent call last):; B4 S" z3 ?  w! f# \8 f2 M
  File "/usr/local/python-3.12.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
4 S1 Y: V6 P) A. `/ L! }, v    self.run()
0 y0 ~+ r9 m% m4 k3 A0 q7 D  File "/usr/local/python-3.12.12/lib/python3.12/threading.py", line 1012, in run* [; y8 l; |3 x7 X" q- B" H
    self._target(*self._args, **self._kwargs)0 V* H( S1 A: I% K3 {
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/utils/autoreload.py", line 64, in wrapper, w! ]4 A+ K5 J: j7 x, \- d; a9 n
    fn(*args, **kwargs)
) F, I3 O& v1 u  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/core/management/commands/runserver.py", line 137, in inner_run( O  l% B3 {" s1 q$ p* ]
    self.check_migrations()
  v+ \7 O  M, g1 K6 P5 t  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/core/management/base.py", line 591, in check_migrations
5 ?. D( R6 b% K3 k5 ?    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])( ?6 `7 m9 G; l! \
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^( e' {. Y7 w2 N1 g7 d* U% M
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 18, in __init__9 Q  w, N7 Y: p2 ^  W; D4 |
    self.loader = MigrationLoader(self.connection)
5 _) b# r- h$ @) L5 H3 N                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^$ ^# s: m7 \/ |- S9 P% [
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/migrations/loader.py", line 59, in __init__
7 Y6 r$ p. X1 [0 t. z9 i4 L. Q8 u; i    self.build_graph()
& ^2 @, B& w) U3 P+ y  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/migrations/loader.py", line 288, in build_graph2 E8 r- ?$ x% O: A
    self.applied_migrations = recorder.applied_migrations()
9 f" F, j" U) ~                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^/ e! }3 v8 z; c
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/migrations/recorder.py", line 89, in applied_migrations
8 `3 a* o: Y+ A: V% `    if self.has_table():" ?# Z* r/ e: h' r! j6 n0 Y
       ^^^^^^^^^^^^^^^^
% g. r" X4 ^8 @  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/migrations/recorder.py", line 63, in has_table
0 B# h- f) x# u7 \4 `5 |    with self.connection.cursor() as cursor:5 U6 o# s4 r0 _* y9 F
         ^^^^^^^^^^^^^^^^^^^^^^^^8 g! Q, y# `0 k. Y
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner5 D; R* r1 V6 _) r
    return func(*args, **kwargs). }" ]0 A! g$ j% y' u- e
           ^^^^^^^^^^^^^^^^^^^^^
1 N# a9 N# r2 w0 |7 @. R  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 320, in cursor3 Q9 A, h$ G% l0 j8 h
    return self._cursor()% ?' |; j7 m8 [9 F  T& M( R' q
           ^^^^^^^^^^^^^^7 F- Q! n4 a3 S' \
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 296, in _cursor
* ~: o. p. E2 H' ?6 |    self.ensure_connection()
! W" v4 _# y8 l- r  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner( B2 t1 N) }6 R; ^/ x; i( C
    return func(*args, **kwargs)
' x9 V3 I$ o# y3 W# f& o$ {9 q) a, [+ a           ^^^^^^^^^^^^^^^^^^^^^
  Y& A( M0 H. x& i" p1 W: K8 _  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 278, in ensure_connection6 t2 ]. ]5 G/ f  \' A: x
    with self.wrap_database_errors:
1 d7 {! ]5 Y! b& e, z- C* {5 w         ^^^^^^^^^^^^^^^^^^^^^^^^^
! _. g8 L- Y" c  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/utils.py", line 94, in __exit__
3 Z- A1 y* v4 N9 m; j7 u  F# W    raise dj_exc_value.with_traceback(traceback) from exc_value
! W  a9 N- R7 d  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 279, in ensure_connection* v% k* r- n: P  }2 ?
    self.connect()
8 E9 k- u% ]! y! x  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
! l$ }7 ~0 f! _$ |- K5 G    return func(*args, **kwargs)* Z8 `# J& ?3 g" S
           ^^^^^^^^^^^^^^^^^^^^^9 o0 L! `, `" C. O* [2 ^4 K2 ]4 R
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect
/ }6 p* h. T; `: d/ d    self.connection = self.get_new_connection(conn_params)
/ H8 Y( }8 a% j( ^3 ?                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^% B# Y# ^, f7 m9 O+ ^
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
, @% A- G5 H! W' L6 h+ m" l! U    return func(*args, **kwargs); f, P5 g; l3 Y9 W# e0 q, x
           ^^^^^^^^^^^^^^^^^^^^^8 i- y2 ?* W( Q5 O. W9 O: r
  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/django/db/backends/mysql/base.py", line 258, in get_new_connection
( O( H  g* i& C    connection = Database.connect(**conn_params)1 y' r  t/ P7 [: }! T
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/ I2 Q/ v$ s1 G+ l4 ]' E! d5 i- M  a  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/MySQLdb/__init__.py", line 121, in Connect! L6 `7 t+ {% {( n" E
    return Connection(*args, **kwargs)
; S; X' P% {+ |& Q8 }           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 x# g9 o+ G5 R5 N4 A( B  File "/usr/local/pythondjango/Watchtower/.venv/lib/python3.12/site-packages/MySQLdb/connections.py", line 200, in __init__
# W7 N0 E$ U1 c% l& `0 X    super().__init__(*args, **kwargs2)
8 U" h  g3 [$ {/ k( Y& n% u+ {# @django.db.utils.OperationalError: (2002, "Can't connect to server on '192.168.16.37' (115)")) `7 y! b3 W* J$ j6 j( e" b$ T; @

" Y, z4 f/ j- Z# d6 L3 Y8 ?
; H1 D6 v1 @2 m- n% j! b4 t
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-11 23:21 , Processed in 0.018453 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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