找回密码
 注册
查看: 43|回复: 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.
1 p7 h* _0 \% t  warnings.warn("DateTimeField %s received a naive datetime (%s)"
3 k+ V+ p3 x  a; z& lC:\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.
# r4 D' R5 @4 a* T  warnings.warn("DateTimeField %s received a naive datetime (%s)"0 p2 ]3 [! H% S! C8 w
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.- D2 ^1 e# H% F7 `, H7 \  W
  warnings.warn("DateTimeField %s received a naive datetime (%s)"4 a( y4 x3 p# V
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-24 00:00:00) while time zone support is active.4 G2 R9 z& s2 f4 z
  warnings.warn("DateTimeField %s received a naive datetime (%s)"1 A3 Y7 R* ?; E8 Z% R9 b
[25/Jul/2025 23:03:09] "GET /master/ HTTP/1.1" 200 10084
2 I( Q9 L) f. f: tC:\Users\admin\Desktop\deskdirectory\trip\trip\settings.py changed, reloading.
0 q1 I- O$ V: P/ q9 t
$ Y: q# w5 q7 z/ T6 ?. f& ~4 T' O2 |) [$ |) m: s
报错:0 n" M; F. m/ v4 W0 \( y0 e( I5 R
找到settings.py文件:' Y2 d8 U% P- E
+ w( B9 V" X6 @' c% J: E* _- t2 K
找到
0 v% l9 c# x9 R) o9 G/ f5 l, vUSE_TZ = True
: \) c9 _6 b  h: r6 r- s% a0 B4 ?4 [4 s( h! J
改成:! W8 K) I6 c: n' b7 e2 \* u

3 w( [' R8 b1 q: p* L. f( \0 j/ U9 I& T2 O6 W' j: ^" h
USE_TZ = False% ]  _- U% S+ s: _3 P' Q0 _
' }6 B8 n6 U7 @4 N  `5 N0 e% d

7 y# [3 U$ g5 A3 O+ Y保存重启,问题不在出现:( n, E: y: D0 \! j5 b0 _

/ U2 S1 A: m$ d" B8 C. MWatching for file changes with StatReloader5 Y( B) B/ z; G0 W
System check identified no issues (0 silenced).
* @3 Z2 Z. r5 X. U$ ?July 25, 2025 - 23:06:14
/ i/ t. }* U, `* ^2 j9 KDjango version 3.0.5, using settings 'trip.settings'
" z5 V0 W+ e; `" j; QStarting development server at http://0.0.0.0:8000/
2 L8 P0 \/ R7 B, d' o0 b5 NQuit the server with CTRL-BREAK.
# |2 e, n$ [0 d8 ?2 a' p[25/Jul/2025 23:06:19] "GET /master/ HTTP/1.1" 200 10094
* q/ U/ f" L! C$ S) S7 n/ N1 F  T6 F% c+ R. O( U
. M5 q) ~: K3 \& u3 e, G( [
7 U, }0 r, t! E1 ~0 }: l& ~
问题解决。
8 d. [# n' I+ s1 ~" b; z
, J% p& J  E9 ~. r- I' S0 [
3 y* K; ~, ?, j  D( Y: K$ l
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-11 23:14 , Processed in 0.026145 second(s), 23 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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