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

django python 报错warnings.warn("DateTimeField %s received a naive datetime (

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2025-7-25 23:09:10 | 显示全部楼层 |阅读模式
C:\Users\admin\python3.8.2-vitual\lib\site-packages\django\db\models\fields\__init__.py:1365: RuntimeWarning: DateTimeField Order.created_at received a naive datetime (2025-07-25 00:00:00) while time zone support is active.+ [* t# m* `* G8 L9 J. J
  warnings.warn("DateTimeField %s received a naive datetime (%s)"
& X2 O7 |1 @# x* _/ }4 y9 n3 _C:\Users\admin\python3.8.2-vitual\lib\site-packages\django\db\models\fields\__init__.py:1365: RuntimeWarning: DateTimeField Profile.created_at received a naive datetime (2025-07-25 00:00:00) while time zone support is active./ m' ]6 b6 a) J4 Q0 H. Z2 w$ r# I
  warnings.warn("DateTimeField %s received a naive datetime (%s)"" S6 d; G5 O8 d7 Y+ e# k, d" e
C:\Users\admin\python3.8.2-vitual\lib\site-packages\django\db\models\fields\__init__.py:1365: RuntimeWarning: DateTimeField Order.created_at received a naive datetime (2025-07-24 00:00:00) while time zone support is active.
$ Z9 x- d4 h- A7 u' F5 O  warnings.warn("DateTimeField %s received a naive datetime (%s)"
  h) h/ Q, c% S" r( JC:\Users\admin\python3.8.2-vitual\lib\site-packages\django\db\models\fields\__init__.py:1365: RuntimeWarning: DateTimeField Profile.created_at received a naive datetime (2025-07-24 00:00:00) while time zone support is active.8 U6 a. t0 G! E% Y' N1 Y1 J
  warnings.warn("DateTimeField %s received a naive datetime (%s)"
0 E2 j1 u5 z+ P8 h[25/Jul/2025 23:03:09] "GET /master/ HTTP/1.1" 200 10084
3 O* I/ ~2 ?. ^% s* G) j) q/ ]C:\Users\admin\Desktop\deskdirectory\trip\trip\settings.py changed, reloading." C- `/ u! w$ ]$ R0 F
3 d6 c+ `/ [8 j
- N8 ?1 Y3 n2 A: Y/ d0 d
报错:
& S0 t0 `8 }! V1 N6 G4 o找到settings.py文件:3 Q' j8 v+ n3 O' F

3 @! ~& G- a% H, D/ U) z找到
" j( n# Z( ]0 g. L5 d3 YUSE_TZ = True/ Y, B; c  l/ P9 Q1 a, S6 d* Z
$ e8 }" R5 e  H; s/ E
改成:
1 }3 J' z1 N2 @0 G8 q2 N) l! Y9 o
0 F* _4 A) z* K) A
USE_TZ = False! c  P' F  x: K9 i

' q/ ]- T" K1 f
- H: P  }/ c3 j2 b" e/ g& o保存重启,问题不在出现:3 }  E! m$ X/ y9 y* K7 V" e  O: z# U

; H7 w/ ?& Q7 w! z( p: Q# RWatching for file changes with StatReloader
) t0 ?/ x( m# f9 o: r+ TSystem check identified no issues (0 silenced).2 A  i5 w+ d7 W! [& t+ y
July 25, 2025 - 23:06:14, V5 Y; g; i8 a; m' {' Y8 U
Django version 3.0.5, using settings 'trip.settings'  R1 M% z3 S; n6 [9 }. s: h
Starting development server at http://0.0.0.0:8000/1 f" B; J' a7 a& }+ C
Quit the server with CTRL-BREAK.
! L9 s8 B0 L! j3 H! D, t[25/Jul/2025 23:06:19] "GET /master/ HTTP/1.1" 200 10094# A1 J! P5 \# I. C: ^# Q. |! ]
1 @; t- C8 _5 h0 i# v% ^
: e1 X5 s: Y( m5 t3 `

; X" j1 D/ q( q7 Z) x. T. h2 i8 x问题解决。% e; @3 a5 y$ w: y# ]
1 t" M. t& g. G1 A
) V4 U$ J6 ]( a+ m) h
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

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

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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