Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7755461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:34:30+00:00 2026-06-01T12:34:30+00:00

I have a django 1.3 project and I’m in the process of adding text

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:34:31+00:00Added an answer on June 1, 2026 at 12:34 pm

    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:

    1. Gets the naive datetime from SQLite, sets it to aware datetime with UTC timezone
    2. So then when you access the model_instance.datetime_field, it’s already timezone aware and localized to UTC
    3. Then in templates for example, you can localize it to current timezone

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a django project that uses a worker process that sends emails to
I have a django project that I have been working on as a solo
I have a django project that runs on a Linux server, and I've been
I have Django project on Dreamhost server which has several views that returns Json
I have a django project that uses a sqlite database that can be written
I have a Django project that contains two applications App1 and App2 I have
I have a Django project that uses Celery for running asynchronous tasks. I'm doing
I have a django project that uses a lot of 3rd party apps, so
I have a django project that uses views from an external app. The view
I have a django project that uses a postgres db with a number of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.