I have a django 1.3 project and I'm in the process of adding text notifications that will run on a certain schedule. As such, I'm going to need the app to be timezone aware. It looks like django 1.4 handles this pretty well. THe problem is that I am using SQLite for db, and it doesn't store the timezone info, so I have to convert. I'm a django newbie. ANy suggestions on how to convert datetime fields in SQLlite to timezone-aware fields.
By the way, when I launch the manage.py shell after upgrading to django 1.4 and activating timezone support, I get the following message:
RuntimeWarning: SQLite received a naive datetime (2012-04-05 15:18:49.939725) while
time zone support is active. RuntimeWarning)
Thanks!
You don't convert datetime fields in SQlite to timezone-aware fields. Within SQlite the datetime is still going to be naive but converted to UTC. And the timezone aware datetimes ara available at the application level.
For example, when you query for a Model instance from SQlite, that has a datetime field, Django:
EDIT: Corrected my initially wrong answer, about what you get on the model instance.
If currently the datetimes in your SQlite db are not UTC, you'll need to do a one-time migration to convert them all to UTC. (and by UTC I just mean naive UTC value. As SQlite - and also MySQL - do not have datetime fields that store timezone info)
I suggest you read the timezone related documentation very carefully and thoroughly: https://docs.djangoproject.com/en/1.4/topics/i18n/timezones/
It's very easy to get this wrong.
Yes you'll get RunTimeWarning
for every instance where your code "gives" naive datetimes to Django for saving. You'll have to fix those gradually, make them timezone-aware.