I'm using Sqlite for my project database. I need date and time in my model so i'm using this field.
date = models.DateTimeField()
On the result template(results.html), the time is correct (localtime or TIME_ZONE in my settings.py) The problem is, when i check the database on Django admin page and sqlite db file, it seems like my timezone setting is not applied.(so, maybe UTC)
what is the problem and how could i fix this?
I think the template's parameters are from view, so the timezone.now() is correct and passes the right time. So my guess is that 'date=timezone.now()' passes to sqlite like this: 'insert into table values (date=datetime('now'))' and the timezone of sqlite is maybe set to UTC default. this is what i'm guessing. am i right? also i do not know how to set sqlite database timezone...
p.s On the other side, I also think when we set settings.py TIME_ZONE, django would manage all these things. So don't know where to approach. Spending almost 2 days on this problem...
Aucun commentaire:
Enregistrer un commentaire