"manage.py shell" on a fresh project raises RuntimeWarning about naive datetime, if IPython is installed
|Reported by:||carljm||Owned by:||aaugustin|
|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 (14)
comment:1 Changed 3 years ago by carljm
- Component changed from Uncategorized to Database layer (models, ORM)
- Type changed from Uncategorized to Bug
comment:11 Changed 14 months ago by aaugustin
- Has patch unset
- Owner changed from nobody to aaugustin
- Patch needs improvement unset
- Status changed from new to assigned
comment:13 Changed 13 months ago by timgraham
- Triage Stage changed from Accepted to Ready for checkin