django - how do I make my site timezone aware? -


i have app uses

import datetime  datetime.datetime.now() default=datetime.now auto_now=true auto_now_add=true 

i'm changing above codes below.

from django.utils import timezone  timezone.now() # instead of datetime.datetime.now() default=timezone.now # instead of datetime.now auto_now # override save() or pre_save() .. ok don't need change in recent django. auto_now_add # override post_save() set time when `created`.. don't need change either 

am missing or doing superflous?

i'm using open source app , uses lot of datetime.datetime ..
it's pain change that.. hope there easier way.

in settings file have set use_tz = true. docs:

time zone support disabled default. enable it, set use_tz = true in settings file


Comments