Search code examples
djangoipythonpytz

Django IPython sqlite complains about naive datetime


I have a new project in Django 1.4, using sqlite db. Also using django_extenstions' shell_plus with no problems.

When I installed IPython, both shell and shell_plus started to complain about:

/path/to/my/virtualenv/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py:50:
RuntimeWarning: SQLite received a naive datetime (2012-07-29 13:15:45.229464) while time zone support is active.

It seems IPython itself uses unaware datetimes. How can this be fixed?

EDIT:

I don't want to disable Django's timezone support.


Solution

  • I put this in my local_settings.py:

    #ignore the following error when using ipython:
    #/django/db/backends/sqlite3/base.py:50: RuntimeWarning:
    #SQLite received a naive datetime (2012-11-02 11:20:15.156506) while time zone support is active.
    
    import warnings
    import exceptions
    warnings.filterwarnings("ignore", category=exceptions.RuntimeWarning, module='django.db.backends.sqlite3.base', lineno=53)