"manage.py shell" on a fresh project raises RuntimeWarning about naive datetime, if IPython is installed
|Reported by:||Carl Meyer||Owned by:||Aymeric Augustin|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
IPython uses SQLite internally to store shell session history. At the beginning and end of every shell session, it issues a SQLite query to get/save the history. For some reason this query includes a (timezone-naive) datetime.
Django's SQLite DB backend registers a global datetime adapter function which issues a warning in case it receives a naive datetime when timezone support is activated.
In combination, this means that on a fresh
startproject if you fire up
manage.py shell without making a single change to settings, if IPython is installed you'll get "RuntimeWarning: SQLite received a naive datetime (2013-02-04 17:14:13.070091) while time zone support is active." on shell startup and exit. That's an ugly experience for a newcomer to Django - it _looks_ to them as if Django is shipping a broken setup by default.
Probably this is Django's fault for registering a potentially-noisy process-global SQLite adapter, and we should consider whether to just remove that warning in the adapter. The model layer will already warn about naive datetimes, so this warning is only needed for raw SQL.
Change History (15)
comment:1 Changed 4 years ago by
|Component:||Uncategorized → Database layer (models, ORM)|
|Type:||Uncategorized → Bug|
comment:11 Changed 23 months ago by
|Owner:||changed from nobody to Aymeric Augustin|
|Patch needs improvement:||unset|
|Status:||new → assigned|