5π
β
Youβre looking for this:
21 try:
22 try:
23 from pysqlite2 import dbapi2 as Database
24 except ImportError, e1:
25 from sqlite3 import dbapi2 as Database
26 except ImportError, exc:
27 from django.core.exceptions import ImproperlyConfigured
28 raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
It first attempts to import PySqlite, an external module. If that fails, it tries to import the sqlite3 module included in Python 2.5+. If neither Python 2.5+ nor the external module are installed, it fails. It does not include its own copy.
π€Bob
4π
Sqlite is part of the Python standard library, so it is always available to Django.
π€Ned Batchelder
- [Django]-Display different templates based on host in Django
- [Django]-Error on django runserver β OverflowError: getsockaddrarg: port must be 0-65535
- [Django]-Django middleware to determine user's group in a session
- [Django]-Is it possible to run ubuntu terminal commands using DJango
3π
I think SQLite comes standard with Python 2.5+ β so it doesnβt need to be bundled with Django.
π€nrabinowitz
- [Django]-Django method to change User email not working
- [Django]-Django API Framework β Nested Models View
- [Django]-Django aggregation over annotated query
Source:stackexchange.com